I hope this is a simple stupid noob bug that can be fixed by adding one line of code somewhere.
I use pySerial to read in serial data from a USB port and print it to standard output. I am running Mac OSX 10.6. I open a terminal and write "python", and then the following:
>>> import serial;
>>> ser = serial.Serial('/dev/tty.usbserial-XXX', 9600, timeout=1);
>>> while True:
>>> if ser.inWaiting() > 0:
>>> ser.readline();
>>> [done, I hit enter...]
It works great. He begins to issue my serial data beautifully, exactly as I expected. Great, I think, let me put this in my own script with command line arguments, and then I can call it anytime I want:
import sys;
import serial;
serialPort = sys.argv[1]
baudRate = sys.argv[2]
ser = serial.Serial(serialPort, baudRate, timeout=1)
while True:
if ser.inWaiting() > 0:
ser.readline()
"python myScript.py [ ] 9600" , . , .
, , , - - . while, :
while True:
print("looping...")
print(ser.inWaiting());
if ser.inWaiting() > 0:
ser.readline()
, "Looping..." "0". , , , - , script, .
, ? True: - script ? ?
Python noob. script, Adobe AIR Arduino. , , - ?