Python Forum
Serial communication with raspberry pi 3B and Xbee - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Serial communication with raspberry pi 3B and Xbee (/thread-17021.html)



Serial communication with raspberry pi 3B and Xbee - kj7 - Mar-25-2019

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)