November 22nd, 2013, 12:30 PM
Newbie! "simple" question on Pyserial
This is very basic
I'm using Pyserial to read and write to a motor controller
#select I2C device
ser.write( "\x55\xB0\x05" )
#n = ser.read(1)
#print "selected encoder register" , n
# set I2C device to read and read a byte from register 5
ser.write( "\x55\xB1\x05\x01" )
n = ser.read(1)
print "ENCODER motor 1 low byte ", n
This code works but n is printed out as an ASCII character.
I want to change this so that I can print out or save as a numeric value the value of the byte(s) returned by n
November 22nd, 2013, 02:28 PM
instead of n.
[/code] are essential for python code and Makefiles!