I have a CPx4 and a xbee rf module.
I am wanting to read the IO status from the remote module back to the CPx4.
What i think i need to do is send it to the comport of the CPx4 but i cant get my python code to work.
any help would be great!
I have a CPx4 and a xbee rf module.
I am wanting to read the IO status from the remote module back to the CPx4.
What i think i need to do is send it to the comport of the CPx4 but i cant get my python code to work.
any help would be great!
No, you do not use the COM port on the gateway to collect this data . Instead you use a sd.receive or something of that nature. Try using the Hello world example for your specific XBee version and it will provide you with the proper command to access the radios data.
The x4 is
X4-HMU-U801-A
the xbee module is
XBP9B-DMSTB002
I have done the hello word and it dose not tell me anything about any command other than print (’ ')
could you give me an example?
Try this one:
import sys, os
from socket import *
DESTINATION=(“00:0d:6f:00:00:06:89:29!”, 0xe8, 0xc105, 0x11)
sd = socket(AF_ZIGBEE, SOCK_DGRAM, ZBS_PROT_TRANSPORT)
sd.bind((“”, 0xe8, 0, 0))
sd.sendto(“Hello, World!”, 0, DESTINATION)
How do i read/ use the data coming into the x4? I have tried listening but I dont know what port the xbee module in the x4 it is attached to.
You do not need to worry about that. All you need to do is to create the socket as described above and then use the sd.read function to read the data coming in.
In the given program, replace the sendto function with read function.
sd.read() or sd.recvfrom(buflen).
Refer following link for the syntax, http://www.digi.com/wiki/developer/index.php/XBee_Extensions_to_the_Python_socket_API#recvfrom.28.29