def init(stdscr): brick = get_device(0x0694, 0xFF00, timeout=60) if not brick: return False brick.open(NXOS_INTERFACE) command_queue = Queue.Queue(1) output_queue = Queue.Queue() output = threading.Thread(target=output_thread, args=[stdscr, output_queue]) output.start() usb = threading.Thread(target=usb_thread, args=[brick, command_queue, output_queue]) usb.start() return (command_queue, output_queue, output, usb)
def main(): print "Looking for NXT...", brick = get_device(0x0694, 0xFF00, timeout=60) if not brick: print "not found!" return False brick.open(NXOS_INTERFACE) print "ok." prompt = RcmdConsole() prompt.set_brick(brick) prompt.interact('Remote robot command console.') print "Closing link...", brick.write('end') print "done."
def init(stdscr): brick = get_device(0x0694, 0xff00, timeout=60) if not brick: return False brick.open(NXOS_INTERFACE) command_queue = Queue.Queue(1) output_queue = Queue.Queue() output = threading.Thread(target=output_thread, args=[stdscr, output_queue]) output.start() usb = threading.Thread(target=usb_thread, args=[brick, command_queue, output_queue]) usb.start() return (command_queue, output_queue, output, usb)
def main(): print "Looking for NXT...", brick = get_device(0x0694, 0xFF00, timeout=60) if not brick: print "not found!" return False brick.open(NXOS_INTERFACE) print "ok." # Read data size print "Waiting for data size...", read_size = brick.read(4, 5000) if not read_size: print "timeout!" return False size = struct.unpack("<L", read_size)[0] print "ok. Expecting %d bytes." % size # Receive data print "Receiving data...", data = brick.read(size, 10000) if not data: print "timeout!" return False print "ok." data = [ord(i) for i in data] if len(sys.argv) > 1: if sys.argv[1] == 'i2c': from i2c_pin_data import beautify beautify(data, size) elif sys.argv[1] == 'ascii': from ascii_dump import beautify beautify(data, size) else: print[str(i) for i in data] return True
def main(): print "Looking for NXT...", brick = get_device(0x0694, 0xFF00, timeout=60) if not brick: print "not found!" return False brick.open(NXOS_INTERFACE) print "ok." # Read data size print "Waiting for data size...", read_size = brick.read(4, 5000) if not read_size: print "timeout!" return False size = struct.unpack("<L", read_size)[0] print "ok. Expecting %d bytes." % size # Receive data print "Receiving data...", data = brick.read(size, 10000) if not data: print "timeout!" return False print "ok." data = [ ord(i) for i in data ] if len(sys.argv) > 1: if sys.argv[1] == 'i2c': from i2c_pin_data import beautify beautify(data, size) elif sys.argv[1] == 'ascii': from ascii_dump import beautify beautify(data, size) else: print [ str(i) for i in data ] return True