I’m trying to write a python script that enable ConnectPort X2e to receive data sent from multiple Xbee S2 RF module(XB24-ZB). Does any one can give some suggestions about how to start?
The current network configuration is, a ConnectPort X2e gateway as a coordinator to receive data. 2-3 Xbee S2 RF modules are placed at different locations on a room, and keep sending a designated number. What I trying to achieve is to use the Xbee gateway to receive the number sent by those Xbee RF module.
As I know I have to write a python script to make this work, so I would like to ask where can I find related reference documents, tutorials, or examples. Many thanks!
The Hello World sample doesn’t help at all.
it just simply print “Hello World”.
The answer I looking for is, which Xbee Python API(module/funtion) should I use, so that the gateway is able to get data sent by Xbee RF module. However, I already figured it out. Thanks
You need to open a socket -
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_TRANSPORT)
and bind at -
sd.bind((“”, 0xe8, 0, 0))
then use -
payload, src_addr = sd.recvfrom(255)
Now unpack the payload and parse it.