Example #1
0
    #The packet is data recieved from the radio
    elif name == 'rx':
        src_addr = packet.get('source_addr')
        rssi = packet.get('rssi')
        options = packet.get('options')
        data = packet.get('rf_data')
        #Handle packet in whatever way is appropriate
        print 'Packet received'
        
    
#Initialize the basestation and the helper functions
xb = BaseStation('/dev/tty.usbserial-A800fdFZ', 230400, DEST_ADDR, xbee_received)
base = BaseFunctions(xb)
robot = RobotFunctions(xb)

if __name__ == '__main__':
    
    base.getChannel('a')
    base.getSrcAddr('b')
    base.getPanID('c')
    
    base.setChannel('\x17')

    robot.go(40)
    
    time.sleep(1)
    
    robot.stop()
    
    print '\n'
    sys.exit()