Home/Support/Support Forum/How to read IO status from XBEE to connectport X$
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to read IO status from XBEE to connectport X$

0 votes
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!
asked Jun 27, 2014 in Python by Electrofab New to the Community (0 points)

Please log in or register to answer this question.

3 Answers

0 votes
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.
answered Jun 27, 2014 by mvut Veteran of the Digi Community (10,767 points)
The x4 is
the xbee module is
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?
0 votes
Try this one:

import sys, os
from socket import *

# The Format of the tuple is:
# (address_string, endpoint, profile_id, cluster_id)
# The values for the endpoint, profile_id, and
# cluster_id given below are the values used to write
# to the serial port on an Ember-based XBee module.
DESTINATION=("00:0d:6f:00:00:06:89:29!", 0xe8, 0xc105, 0x11)

# Create the socket, datagram mode, proprietary transport:

# Bind to endpoint 0xe8 (232):
sd.bind(("", 0xe8, 0, 0))

# Send "Hello, World!" to the destination node, endpoint,
# using the profile_id and cluster_id specified in
sd.sendto("Hello, World!", 0, DESTINATION)
answered Jun 27, 2014 by mvut Veteran of the Digi Community (10,767 points)
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.
0 votes
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
answered Jul 25, 2014 by 16ksa23 Veteran of the Digi Community (426 points)
Contact a Digi expert and get started today! Contact Us