[solved]Problem writing serial strings - Raspberry Pi Forums
using python 3 want send serial string raspberry pi arduino that's running sinewave generator. works fine need frequency variable doing wrong?
code: select all
ser = serial.serial('/dev/ttyusb0', timeout = 1) ser.write(b'200')
code: select all
f = '200' # raises error ser.write(f) # sends garbage ser.write(b'f')
you have encode it, first convert number string. can like
str(f).encode()
python2 did lot of things 'automatically' ok of time frustrating!
str(f).encode()
python2 did lot of things 'automatically' ok of time frustrating!
raspberrypi
Comments
Post a Comment