arduino

Serial port does not work in rewritten Python code

ぐ巨炮叔叔 提交于 2019-12-23 15:36:46
问题 I have a Python program that reads some parameters from an Arduino and stores it in a database. The serial port is set up and used like this: ser = serial.Serial(port=port, baudrate=9600) ser.write('*') while 1 : ser.write('*') out = '' # Let's wait one second before reading output (let's give device time to answer). time.sleep(1) while ser.inWaiting() > 0: out += ser.read(1) if out != '': etc ... handling data (The Arduino is set up so when it receives a star, it sends back a data string.) I

Bluetooth control signals (DTR, DSR, RTS, CTS) on Android

好久不见. 提交于 2019-12-23 15:13:04
问题 I would like to remotely reprogram my Arduino via Android over Bluetooth SPP. The first step is to reset the ATMEGA microcontroller. This is accomplished on the Arduino by toggling the DTR line. Is there any API to control the Bluetooth SPP control lines from the Android environment? 回答1: Also it is supported by SPP in general to send or receive the control signals (DTR, DSR, RTS, CTS) I do not know any API or library for android right know, but as you just want to reset your controller... If

esp8266与arduino互通

时光怂恿深爱的人放手 提交于 2019-12-23 12:31:07
引脚相连接: VCC与CH_PD串联接3.3v RX与TX根据代码对应的相接(下面代码有) GDN接地 其他没有了 代码用实例里面的softwareserialexample 硬件部分: Arduino 、 esp8266-01 、 代码: # include <SoftwareSerial.h> SoftwareSerial mySerial ( 10 , 11 ) ; // RX, TX char val ; void setup ( ) { // Open serial communications and wait for port to open: Serial . begin ( 115200 ) ; while ( ! Serial ) { ; // wait for serial port to connect. Needed for native USB port only } Serial . println ( "Goodnight moon!" ) ; // set the data rate for the SoftwareSerial port mySerial . begin ( 115200 ) ; mySerial . println ( "Hello, world?" ) ; pinMode ( 8 , OUTPUT ) ; } void

How do you define a char array as a constant?

笑着哭i 提交于 2019-12-23 10:24:32
问题 C/C++ noob here. I've defined this in a header file... typedef unsigned char BitChar[9]; // 8 data bytes (chars) and one width byte (char) extern BitChar BitFont[]; and I have this in a cpp file... BitChar BitFont[] = { B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,2, // 32 - Space B10000000,B10000000,B10000000,B10000000,B10000000,B00000000,B10000000,B00000000,1, // 33 - ! ... B00000000,B00000000,B11100000,B11100000,B11100000,B00000000,B00000000,B00000000,3,

Is there a general I2C command to see if a device is still present on the bus?

半城伤御伤魂 提交于 2019-12-23 10:09:16
问题 Is there a general I2C command to see if a device is still present on the bus after it is initialized once? For example an OLED display. The reason I ask this is to avoid the main program will freeze (when a device is disconnected) because of infinite loops present in the library code, in for example, the Wire library. At startup of the MCU I want to check if a device is available or not, and initialize it when it is available. I do this with this function and works fine ..... bool MyClass:

How can a Pinoccio lead scout make a POST request to a remote server?

前提是你 提交于 2019-12-23 05:23:30
问题 I'd like my Pinocc.io lead scout to make a POST request (e.g. to inform a remote service of an event that has been triggered). Note that I don't want to listen to a constant stream the results (as detailed here) as I don't want to be constantly connected to the HQ (I'm going to enable the wi-fi connection only when required to minimize battery usage), and the events I'm detecting are infrequent. I would have thought that this is a very common use case, yet I can find no examples of the lead

Creating a Library for an Arduino

醉酒当歌 提交于 2019-12-23 03:24:09
问题 I have some code that I wanted to put into a library which uses another library, SoftwareSerial. Now I added the SoftwareSerial.h and SoftwareSerial.cpp files to the same folder as the library I'm creating. My header file looks something like this: #ifndef MyLibrary_h #define MyLibrary_h #include "Arduino.h" #include "SoftwareSerial.h" #define MyLibrary_VERSION 1 // software version of this library //DEFINE ALL CLASS VARIABLES #define DATA_BUFFER_SIZE 50 //soft serial has 63 byte buffer.

doit 2-way motor & 16-way servo shield board

浪子不回头ぞ 提交于 2019-12-23 02:35:08
问题 Got this board cheap from Banggood, but there are minimal details on how to use it. There is a manual here https://www.gitbook.com/book/smartarduino/user-manual-for-2-way-motor-16-way-servos-shield/details , but it is a long way from detailed, and what I need are some details on how to drive the I2C PWM servos. 回答1: After some poking around, I have a partial answer. The Adafruit libraries seem to work fine for the servos. https://learn.adafruit.com/16-channel-pwm-servo-driver/using-the

jSSC Not Sending Data to Arduino

半世苍凉 提交于 2019-12-23 02:01:40
问题 I have a problem with writing function of jSSC. My Arduino Uno board seems not getting data from my Java program. I have a stepper motor controlled by Arduino Uno board. I made a simple program that has 2 buttons. One is for CW rotation and the other is CCW rotation. CW button sends 'H' char and CCW button sends 'L' char. Now I have: I checked from Arduino IDE serial console my Arduino program works correct. When I send 'H' the motor turns CW and with 'L' the motor turns CCW. I made a program

How to make Scilab open a serial communication with /dev/ttyACM0 USB port in Linux (Ubuntu)

≯℡__Kan透↙ 提交于 2019-12-22 18:44:08
问题 I'm trying to open a serial communication between Scilab and Arduino. However, Arduino is always recognized by Linux Ubuntu in the /dev/tty**ACM0** port. When I write h=openserial(1,"9600,n,8,1) in Scilab I know that I'm saying to it, to open a serial comunication to COM1 or /dev/tty**S0** in Linux. But, for example, if I use h=openserial(N,"9600,n,8,1) , assuming N=port number , I will always have COMN, in Windows and /dev/tty**S**(N-1) in Linux. How do I open a serial comunication through