0

I am using XBee modem to make mutual remote communication system.

Initially I tried using Arduino, however, I figured out that using two single board computer with python would be much more convenient. I am using pyserial right now.

This is the code which I made. It is really simple, and I don't see there would be something cause error.

Transmitter

import serial
import time
Xserial=serial.Serial('COM4',9600)
for i in range(10):
 print(i)
 Xserial.write(b"Test2")
 time.sleep(3)
Xserial.close()

Receiver

import serial
import time
XSerial=serial.Serial('COM10',9600)
while (True):
 line=XSerial.read(1)
 print(line)
XSerial.close()

I think transmitter is working, however, receiver does not seem to receive what I send.

I am sure that it was working yesterday, but it is not working today. I checked XCTU and the connection is fine. I can communicate with each other by XCTU.

asked Jun 10, 2021 at 15:36
4
  • They definitely on the right COM ports? Commented Jun 10, 2021 at 15:37
  • Yes. It works properly with XCTU. Commented Jun 10, 2021 at 16:11
  • What does the receiving end show? It looks like you're only reading a single character at a time (read(1)). Commented Jun 11, 2021 at 1:01
  • And if you have simple requirements, perhaps using MicroPython on an XBee3 module would be the way to go. No need for an additional microprocessor and it eliminates the serial communication. Commented Jun 11, 2021 at 1:02

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.