示例#1
0
if __name__ == '__main__':
    
    XBEES = [xb1, xb2]
    
    print "Setting temporary XBee config..."
    
    # Change xbee settings
    xb1.setChannel(XB_CHAN)
    xb1.setSrcAddr(XB1_ADDR)
    xb1.setPanID(XB_PANID)
    
    print "--------  XBee #1  ----------"
    chan = xb1.getChannel()
    print "xbee CHAN : 0x%x" % chan
    src = xb1.getSrcAddr()
    print "xbee SRC addr : 0x%x" % src
    pan = xb1.getPanID()
    print "xbee PAN ID : 0x%x" % pan
    print "\n",
    
    # Change xbee settings
    xb2.setChannel(XB_CHAN)
    xb2.setSrcAddr(XB2_ADDR)
    xb2.setPanID(XB_PANID)
    
    print "--------  XBee #2  ----------"
    chan = xb2.getChannel()
    print "xbee CHAN : 0x%x" % chan
    src = xb2.getSrcAddr()
    print "xbee SRC addr : 0x%x" % src
示例#2
0
#Define constants to use
DEST_ADDR = '\x20\x12'

#Initialize the basestation and the helper functions
xb = BaseStation('COM3', 57600, verbose=False)

if __name__ == '__main__':

    print "Type Ctrl+C to exit at any time."

    print "Initial settings:"
    print "-----------------"
    chan = xb.getChannel()
    print "xbee CHAN : 0x%x" % chan
    src = xb.getSrcAddr()
    print "xbee SRC addr : 0x%x" % src
    pan = xb.getPanID()
    print "xbee PAN ID : 0x%x" % pan

    # Change xbee settings
    print "\n"
    print " -- changing xbee CHAN to 0xe"
    xb.setChannel('\x0e')
    print " -- changing xbee SRC to 0x1234"
    xb.setSrcAddr('\x12\x34')
    print " -- changing xbee PAN to 0x9999"
    xb.setPanID('\x99\x99')

    print "\n"
    print "Changed settings readback:"
示例#3
0
#Define constants to use
DEST_ADDR = '\x20\x12'

#Initialize the basestation and the helper functions
xb = BaseStation('COM3', 57600, verbose = False)

if __name__ == '__main__':
    
    print "Type Ctrl+C to exit at any time."
    
    print "Initial settings:"
    print "-----------------"
    chan = xb.getChannel()
    print "xbee CHAN : 0x%x" % chan
    src = xb.getSrcAddr()
    print "xbee SRC addr : 0x%x" % src
    pan = xb.getPanID()
    print "xbee PAN ID : 0x%x" % pan
    
    # Change xbee settings
    print "\n"
    print " -- changing xbee CHAN to 0xe"
    xb.setChannel('\x0e')
    print " -- changing xbee SRC to 0x1234"
    xb.setSrcAddr('\x12\x34')
    print " -- changing xbee PAN to 0x9999"
    xb.setPanID('\x99\x99')
    
    print "\n"
    print "Changed settings readback:"