I'm having some trouble getting my arduino uno to communicate with a simple python script through pyserial.
Lets start with my arduino sketch:
void setup() {
Serial.begin(9600);
}
byte i = 0;
void loop() {
Serial.println(i);
i = i + 1;
}
Really dead simple. It just spews the numbers from 0 to 255 over and over again. It works fine in the arduino serial monitor and gets me the expected result.
The python script comes from:
http://playground.arduino.cc/Interfacing/Python
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600)
while True:
print ser.readline()
However running this script gets me:
$ python test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
print ser.readline()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 460, in read
raise SerialException('device reports readiness to read but returned no data (device disconnected?)')
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)
I am using ubuntu 14.04 and python-serial_2.6-1build1_all.deb