import nxt import nxtConnect # has to be in search path import time brickName = "Team60" useUSB = False if useUSB: brick = nxt.find_one_brick(name=brickName, strict=True, method=nxt.locator.Method(usb=True, bluetooth=True)) else: # the bluetooth function of the nxt library works too, but "wastes" # time searching for devices. brick = nxtConnect.btConnect(brickName) print(brick.get_device_info()) # check what brick you connected to from time import sleep from nxt.motor import Motor, PORT_A, PORT_B, PORT_C from nxt.sensor import Touch, PORT_4, PORT_3, PORT_2, Light, PORT_1, Ultrasonic turningMotor = Motor(brick, PORT_B) walkingMotor = Motor(brick, PORT_C) armMotor = Motor(brick, PORT_A) legPosition = Touch(brick, PORT_3) touch = Touch(brick, PORT_1) while True: print(touch.get_input_values().calibrated_value)