diff options
author | Walter Bender <walter@sugarlabs.org> | 2013-10-30 17:24:11 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2013-10-30 17:24:11 (GMT) |
commit | 955cbca83a84b0c1ea06f8c33dfec8dd0f850ed1 (patch) | |
tree | b35c003c4250652885887bfa8e554ce84b2b8696 /pysamples/serial.py | |
parent | 32444889db2d7573426b3e93722a566b36385bc3 (diff) |
comvert custom blocks to new prim style -- args is passed as a tuple
Diffstat (limited to 'pysamples/serial.py')
-rw-r--r-- | pysamples/serial.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pysamples/serial.py b/pysamples/serial.py index 84772ab..d15011c 100644 --- a/pysamples/serial.py +++ b/pysamples/serial.py @@ -9,13 +9,13 @@ # (3) use a Pop Block to retrieve any strings input from serial device. -def myblock(tw, x): # x is the string to transmit +def myblock(tw, args): # x is the string to transmit import serial # you may need to install this library # serial device on USB, 9600 baud ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1) - ser.write(str(x)) # send string x + ser.write(str(args[0])) # send string x st = ser.read(1000) # read up to 1000 bytes tw.lc.heap.append(st) # append to heap ser.close() |