You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building a system where I have a remote Xbee sending packets continuously, and I'm using Raspberry Pi 4 as the host for the Xbee (connected to Xbee grove dev kit) , powered by a battery pack. I have a script that is loaded at Pi startup using crontab:
from digi.xbee.devices import XBeeDevice
import time
PORT = "/dev/ttyUSB0"
BAUD_RATE = 9600
DATA_TO_SEND = "Hello XBee! Sending packet "
def main():
device = XBeeDevice(PORT, BAUD_RATE)
packet_counter = 0
try:
device.open()
print(device.set_sync_ops_timeout(15))
while True:
packet_counter += 1
data = DATA_TO_SEND + str(packet_counter)
print("Sending broadcast data: %s..." % data)
device.send_data_broadcast(data)
print("Success")
time.sleep(0.03)
finally:
if device is not None and device.is_open():
device.close()
if __name__ == '__main__':
main()
What I observe is that the operation is experiencing random timeouts that cause the broadcasting interrupted, although sometimes it works smoothly. I tried to increase the timeout duration device.set_sync_ops_timeout(10) but the problem still persists. One thing to note is that manually running the script doesn't have this issue.
Any ideas to solve this problem is appreciated. I also want to ask a broader question: Is there any way to do something similar for the XBee without the Raspberry Pi (Xbee powered directly by a battery pack)?
The text was updated successfully, but these errors were encountered:
Hello,
I am building a system where I have a remote Xbee sending packets continuously, and I'm using Raspberry Pi 4 as the host for the Xbee (connected to Xbee grove dev kit) , powered by a battery pack. I have a script that is loaded at Pi startup using crontab:
What I observe is that the operation is experiencing random timeouts that cause the broadcasting interrupted, although sometimes it works smoothly. I tried to increase the timeout duration
device.set_sync_ops_timeout(10)
but the problem still persists. One thing to note is that manually running the script doesn't have this issue.Any ideas to solve this problem is appreciated. I also want to ask a broader question: Is there any way to do something similar for the XBee without the Raspberry Pi (Xbee powered directly by a battery pack)?
The text was updated successfully, but these errors were encountered: