CON _xinfreq = 5_000_000 _clkmode = xtal1 + pll16x Var long buttons OBJ xbee : "XBee_Object" pst : "Parallax Serial Terminal" Servos : "Servos_PEKITREV" PUB button_control | temp, index xbee.start(4, 3, 0, 9600) 'Starts the servo object. pst.start(9600) 'Starts debugging terminal pst.Home repeat longfill(@temp, 0, 8) repeat until xbee.rx == "!" {{repeat index from 0 to 8 ' Get buttons temp := xbee.rx temp <<= (8) buttons += temp }} pst.Clear pst.Str(String("Holding for command")) pst.NewLine pst.bin(buttons, 8) 'Testing pst.NewLine pst.bin(xbee.rx, 8) if xbee.rx & |< 1 pst.Str(String("Button Pressed!")) 'This is SMOOTH BUTTON CONTROL on PIN 22 'This is reflected in the LOOKUPZ index above 'The TRIANGLE button will move the servo in one direction waitcnt(clkfreq/40 + cnt)