Python Forum

Full Version: Serial communication with raspberry pi 3B and Xbee
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm new to python programming, if I wanted to know if someone can help me with respect to reading a value that I am receiving serially. In if the topology of my network is based on two parts, in which I have a sensor that sends an analog data by means of an Xbee S2 and is received by another Xbee S2 connected to the raspberry pi 3b. I use the following code but I receive this information:

b ' '
instead you should receive the value of:

65 or 66
the code that I am using is:
import serial

while True: 
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
resu=ser.readline()
#s=ser.read(6)
print('Resultado: ', resu)