Created
March 30, 2012 13:27
-
-
Save fbrosser/2251557 to your computer and use it in GitHub Desktop.
Python serial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import sys | |
ser = serial.Serial('/dev/ttyUSB0', 9600) | |
ys = ""; | |
xs = ""; | |
i = 0 | |
while 1: | |
xs = ""; | |
x = 'q'; | |
while(x != '\n'): | |
x = ser.read() | |
xs += x; | |
if(ys != xs): | |
sys.stdout.write("(" + str(i) + ")\t\t" + xs) | |
i = i+1 | |
ys = xs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment