Hot answers tagged

6 votes
Accepted

How to send numbers to Arduino UNO via Python 3 and the module serial

Parsing on the Arduino can be slow and time-consuming (which is bad if you use clock prescaling or have time-critical tasks), so let's do it in Python. The problem is that you're sending the numbers ...
user avatar
6 votes
Accepted

Arduino Serial Communication with Python: sending an array

If I use >BBB instead of >iii... That's because "B" is a byte. So you end up sending 3 bytes: struct.pack("BBB", 1, 2, 3) \x01\x02\x03 "i" is an int and has a size of 4, so you send 4*3 = 12 bytes: ...
user avatar
5 votes
Accepted

What's the problem with baudrate?

On a direct USB CDC/ACM connection (as you get on the Micro) there is no such thing as baud rate. Any baud rate setting performed by the host (the PC) is merely an instruction to the device (the ...
user avatar
  • 103k
4 votes

Programming an Arduino using Python, rather than C/C++

I have used pyserial with great success in controlling the pins on the arduino. Your workstation (laptop, etc) runs a python script that then communicates in real time to the arduino. It's not quite ...
user avatar
  • 41
4 votes
Accepted

Unpacking Arduino binary data on a python sketch

I'm somewhat confused by the flow of your program, so instead I will tell you how I would handle the data. You have a single-byte header, then 7 bytes of data, followed by a single byte checksum. ...
user avatar
  • 103k
4 votes

Which Arduino is the most suitable for my project?

Both Mega 2560 and Due can handle 4 channels of 1,440 samples per second A-to-D and the least significant byte of the system time stamp sent as a continuous stream of vectors through the USB port to ...
user avatar
4 votes

How can I execute a string in my Arduino Uno board?

Unless you want to implement some form of scripting engine, you can't. Arduino code is compiled code, not interpreted code. There is no way of converting text into runnable code, since that is done by ...
user avatar
  • 103k
4 votes

Pan and tilt bracket move to sound, control servo motors using microphone sound sensors

What you are trying to achieve is not easy. Expect to spend a lot of time developing, testing and tuning it. The first step would be to work the acoustics of your device. The sound sensors are not ...
user avatar
  • 36.9k
3 votes
Accepted

Send numbers to arduino via serial port using python

// save some unsigned ints uint16_t SIZE, *inputList, cont = 0; boolean inputsReady = false; void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); //free ...
user avatar
  • 35.3k
3 votes
Accepted

Handle reading timing in Python using pySerial

The answer is that it depends on what you are actually trying to accomplish. If there is nothing else to be done on the Arduino then it is fine to have it sit and wait; on the other hand if there is ...
user avatar
3 votes
Accepted

Can I program Arduino with Python?

I imagine you want to use python because you are already familiar with it, know your way around the syntax, etc. But I would advice against this line of thinking, because microcontrollers need a ...
user avatar
3 votes
Accepted

Script on pc only gets 640 characters via serial

You are not using a serial connection, you are using a USB CDC/ACM connection, and that is a very very different thing. With a serial connection when you send data it gets sent regardless of whether ...
user avatar
  • 103k
3 votes
Accepted

serial.write if condition

You declare incomingchar as a char. In your if you compare that char to a string (double quotes) incomingchar=="g". I think you want to compare it to a char (single quotes) like this: if ( ...
user avatar
  • 1,091
3 votes

Serial Comm. timing issue between Arduino and Pyserial

Your main problem is in erroneously having a delay in both the sender and the receiver. While this sometimes works by lucky accident, it essentially never does what is hoped for by those who try it. ...
user avatar
3 votes
Accepted

Python - Arduino communication not reliable

In case other people run into similar issues, I'll lay out what I've found today. -The inconsistent output was due to the fact that when you open a serial connection with python, it resets the ...
user avatar
  • 51
3 votes
Accepted

easy_install pip on Arduino Yun fails

Found this Arduino Forum Thread helpful. # wget \ https://pypi.python.org/packages/source/p/pip/pip-6.0.8.tar.gz#md5=2332e6f97e75ded3bddde0ced01dbda3\ --no-check-certificate # easy_install pip-6.0....
user avatar
2 votes

Programming an Arduino using Python, rather than C/C++

Another option to consider is the Arduino Yun. In addition to the AVR chip which most Arduinos have, it also includes a MIPS chip running Linux. Since it's linux, you can easily run python code, and ...
user avatar
  • 171
2 votes

Programming an Arduino using Python, rather than C/C++

Yes,its possible with the recent new ArduinoPro H7 which has abilities to upload a written programme in Python and JavaScript and its a dual core,32bit.
user avatar
  • 21
2 votes

How to send two different sets of int numbers over serial?

I looked at your code, but the main problem seems to be that you have not defined the problem, and it is thus not possible to definitively answer. The conventional solution to this would be to send 2 ...
user avatar
  • 1,645
2 votes

Receiving two-byte int values over serial

void receiveData(int byteCount){ // Looks like your number is sent in a 3 byte packet if (bytecount == 3) { // Discard first number as it is seemingly alway zero Wire.read(); // ...
user avatar
  • 1,353
2 votes
Accepted

Arduino Raspberry Pi USB Communication

You will need PySerial to accomplish this. A tutorial on interfacing Arduino and the RPi using a usb can be found here
user avatar
2 votes
Accepted

Send multiple int values from Python to Arduino using pySerial

I guess I'll answer my own question for anyone else having this issue. What I did was: Python: # write to arduino as raw binary bge.arduino.write(struct.pack('>BBB',45,90,180)) Arduino: #...
user avatar
  • 31
2 votes

Pyserial serial.write() doesn't work

Closely related to To know the state of USB (Serial) connection (connected or not connected) I would not be using Serial.readString() personally. How do you know where the string starts and ends? ...
user avatar
  • 35.3k
2 votes
Accepted

Serial.readString() - how does it work exactly?

readString() will read characters from the serial (or other Stream) device until a timeout occurs. That timeout is, by default, 1 second. It is only appropriate to use readString() if your data is ...
user avatar
  • 103k
2 votes
Accepted

Python PySerial with Arduino fails byte check

I think the problem is that you can't count ;) Spot the difference: 0: [0x01] Frame start 1: [0xMeterValueByte0] 2: [0xMeterValueByte1] 3: [0xMeterValueByte2] 4: [0xMeterValueByte3] 5: [0x04] Frame ...
user avatar
  • 103k
2 votes
Accepted

BLE Python with GUI on OSX

If you are still searching for a lib check out: https://github.com/adafruit/Adafruit_Python_BluefruitLE Its specifically made for BLE communication on OS X or Linux by wrapping the corebluetooth and ...
user avatar
2 votes

Installing Pyserial

not exactly related to Arduino but here it goes... First check if you have pip installed: pip --version if not installed go here and download the get-pip script. then on directory where you saved ...
user avatar
  • 926
2 votes

Installing Pyserial

I'm pretty sure that what you are trying to do is actually call 'python setup.py' within the python script itself. Which you cannot do. The easiest way to install pyserial is via pip like so. (Windows)...
user avatar
  • 146

Only top scored, non community-wiki answers of a minimum length are eligible