Python, Raspberry, and Arduino Communication
- by user2924156
I have been working with my Raspberry, Arduino and applying some Python to make them communicate. I also installed pyserial. If I use IDLE and try the following I get my expected results.
>>> import serial
>>> ser = serial.Serial('/dev/ttyUSB0',115200)
>>> ser.write('x:1\n')
8
>>> ser.readline()
'X:1\r\n'
If I write a python scrip and run it I don't get anything back. Here is my python script.
import serial
ser = serial.Serial('/dev/ttyUSB0', 115200)
ser.write('!x:1\n')
ser.readline()
I am new to Python so looking for some help to understand they this works in IDLE but not as a python script run from terminal.
Thanks.