Question on usage

57 views
Skip to first unread message

berb...@gmail.com

unread,
Apr 15, 2013, 4:38:47 PM4/15/13
to python-...@googlegroups.com
Hi Paul,
 
First of all many thanks for the new package.
I do have a question on the usage of it.
Using series 2 ZigBees, I worked on the receive_samples example and can receive info from one route and 2 end devices.
So far so good. I also wanted to test the ability to remotely set ports and used a small example Harold Kubota made in 2011.
Yesterday It worked, but today it does not.
Also the remote reprogramming of some of the ports does not work.
 
Since I am new to both Python and your software, I wonder. What goes wrong here.
 
Regards,
Bert
 
Here is the example code:
#!/usr/bin/python
# This is a simple demo to remotely turn a LED on and off
# 2011-02-11 Harald Kubota
import serial
from xbee import ZigBee
import time

PORT='//./COM5'
BAUD_RATE=9600
ser = serial.Serial(PORT, BAUD_RATE)
# ZB XBee here. If you have Series 1 XBee, try XBee(ser) instead
xbee=ZigBee(ser, escaped=True)
#MAC, number written on the back of the XBee module
# CO3 = my coordinator
# EP1 = my endpoint with the LED on pin 11
device={         "CO3":'\x00\x13\xa2\x00\x40\x3a\x3d\x59',
                 "EP1":'\x00\x13\xa2\x00\x40\x3a\xa1\x0c' }
#64 bit address
led=False
#change remote device function
xbee.remote_at(dest_addr_long=device["EP1"],command='D2',parameter='\x02')
xbee.remote_at(dest_addr_long=device["EP1"],command='D1',parameter='\x03')
xbee.remote_at(dest_addr_long=device["EP1"],command='IR',parameter='\x04\x00')
xbee.remote_at(dest_addr_long=device["EP1"],command='IC',parameter='\x02')
while 1:
    #set led status
    led=not led
    if led:
        xbee.remote_at(dest_addr_long=device["EP1"],command='D4',parameter='\x04')
    else:
        xbee.remote_at(dest_addr_long=device["EP1"],command='D4',parameter='\x05')
    # wait 1 second
    time.sleep(1)
ser.close()

Paul Malmsten

unread,
Apr 17, 2013, 2:37:13 PM4/17/13
to python-...@googlegroups.com
Hi Bert,

I will take a look though your code when I have a few minutes; probably sometime this weekend. Until then, the most common issues you can investigate are:
  • API mode is not enabled on PC-attached ZigBee
  • PC and PC-attached ZigBee disagree on whether to use escaped communication (i.e. if escaped = True is present on the PC, then "API" should equal 2 on the PC-attached ZigBee)
  • The remote device addresses in your code do not match the actual devices
  • The serial port and/or the serial baud rate you are using in the code do not match the configuration of the PC-attached ZigBee (the code says 9600 baud; the PC-attached ZigBee should be configured likewise).
Regards,
~Paul Malmsten


--
You received this message because you are subscribed to the Google Groups "Python XBee Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-xbee-d...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

berb...@gmail.com

unread,
Apr 19, 2013, 10:57:19 AM4/19/13
to python-...@googlegroups.com
Hi Paul,
 
Ik think I found the answer myself. All ZigBees were configured correctly and also the PC is. It seems that somehow messgaging is clotting up in the network when one of the addressed ZigBees is not yet associated and yet is getting thrown commands to it.
I expected a regularly blinking led on all ZB's but in stead I got two ZB's blinking in a very irregular pace and the ZB that was not yet associated did not blink iets led.
Once all ZB's were associated the leds all blinked in a regular pace.
 
Regards, Bert

Op woensdag 17 april 2013 20:37:13 UTC+2 schreef Paul Malmsten het volgende:

Paul Malmsten

unread,
Apr 24, 2013, 1:09:17 PM4/24/13
to python-...@googlegroups.com
Excellent; I am glad you figured it out.

Regards,
~Paul Malmsten
Reply all
Reply to author
Forward
0 new messages