I want to send serial data ('a'
) to my arduino using python.
The receiving code on the arduino is the following:
char inChar = (char)Serial.read();
if(inChar=='a'){
//do stuff
}
When sending the charachter 'a' from the arduino serial terminal, it works.
However, when sending from python 2.7 (code see below), the rx led flashes but to stuff
is not executed (i.e. inChar=='a'
is false).
I tried everything but I can't solve this problem.
Python code:
import serial
ser = serial.Serial('/dev/ttyUSB0',9600)
ser.write('a')
EDIT: ser.write(b'a')
doesn't work neither