Hi there,
I’m currently doing a project and trying to read some data from a MCU. The XBee I’m using is XBee3 Cellular LTE-M/NB-IoT.
The general process should be as follow:
- xbee send 0x05 to MCU to wake up the MCU, and MCU will send 0x06 back.
- xbee send a command to request some data from MCU and MCU will send a 9-byte data back.
this is the code I’m testing:
send_com(enq)
time.sleep_ms(200)
ack =sys.stdin.read()
if ack!= None:
sys.stdin.close()
send_com(L_E)
time.sleep_ms(90)
link = sys.stdin.read()
if link!= None:
sys.stdin.close()
send_com() is used to send a bytearray to MCU.
The first read is fine and I got ack = ‘\x06’ as it supposed to be.
The second read should give me ‘\x01 0 0 \x03 F 0 5 3 \x04’ but I got link = ‘F 0 5 3 \x04’ instead.
When I reduce the sleep time after ‘send_com(L_E)’, I got link = ‘\x01 0 0’.
I think I probably have some misunderstanding about the buffer. Can someone tell me where I did wrong? Or any helpful documentation recommend?
I appreciate for any answer.