I\'m working on a project in which I have to receive some 25 character data at a time in order to process it in Raspberry Pi. Here is the example code that generates some da
During your loop
function in your Arduino
code you never end an newline char \n
, this is only a problem with ser.readline()
because it reads until a \n
character.
During your setup
function you correctly send a \n
character which could explain the intial value being sent, but not the data.
perhaps modifying your Arduino code like this:
void loop(){
for(i=0;i<25;i++){
for(a=0;a
And your python code like so...
ser = None
try:
ser = serial.Serial('/dev/AMA0',9600,timeout=3)
ser.open()
while True:
try:
serial_data = ser.readline()
print serial_data
except:
pass
except:
pass
finally:
if ser:
ser.close()