Debian Codegraph @

microhope/microhope-doc/prog/receive.py

raw
1 import serial
2 ser = serial.Serial('/dev/ttyS0', 38400, stopbits=1)
3
4 count = 0
5 val = ''
6 while(1):
7 while ser.inWaiting() == 0:
8 pass
9 x=ser.read()
10 if ord(x) == 0: #Print when end of string
11 print (val)
12 val = ''
13 else:
14 val = val + x