Home/Support/Support Forum/Python example "Hello world", how does it work?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Python example "Hello world", how does it work?

0 votes
Hello everyone,
I am a new beginer with Digi ESP. I am trying to do a simple test using ESP python sample XbeeHello.py to establish communication between two ConnectPort Xfamily devices.
As wirten from the Python Programing Guid, I want to send "Hello, world!" to a fixed node address. I loaded below python example into ConnectPort X4 to run with DESTINATION address modified, and sent the"Hello world" to my ConnectPortX2 device.
import sys, os
import xbee
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:13:a2:00:40:4a:3b:5c!", 0xe8, 0xc105, 0x11)

# Create the socket, datagram mode, proprietary transport:
sd = socket(AF_XBEE, SOCK_DGRAM, XBS_PROT_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
# DESTINATION:
sd.sendto("Hello, World!", 0, DESTINATION)

After that I want to receive "Hello world " from my desitination address which is the ConnectPortX2 device. what should I do? Should I use the reading and wirting example to receive and payload back? I am not sure how to do next step. I tried many time from theTelnet, however, it doesn't work.
Can any one help me?
Thank in advance..

Alex Song
asked May 16, 2013 in Python by AlexSong New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
you would need to have a python app running on the X2 that would receive the 'hello world' zigbee packet. it will be something like:
payload, address = sd.recv(160)
answered Jun 7, 2013 by kjensen8 Veteran of the Digi Community (623 points)
...