def test_hi_technc_pir_sensor(self): from ev3.hi_technc import HiTechncPIRSensor pir_sensor = HiTechncPIRSensor(robot.SENSOR_3, 0x02) print( "start PIR sensor test") pir_sensor.set_deadband(10) test_util.count_down(10, lambda:print( pir_sensor.get_measurement() ))
def test_mindsensor_dist_nx_v3_sensor(self): from ev3.mindsensor import DistNxV3 dist_sensor = DistNxV3(robot.SENSOR_4) print('test distance and voltage') test_util.count_down(10, lambda:print('distance:', dist_sensor.get_distance(), 'voltage:', dist_sensor.get_voltage())) print('test de-energize & energize') dist_sensor.de_energize() dist_sensor.energize() time.sleep(0.045) print('You should see distance vaule') print(dist_sensor.get_distance())
def test_setMode(self): uartdevice.set_mode(2,0) test_util.count_down(5) uartdevice.set_mode(2,1) test_util.count_down(5) print( "Color Sensor test!") uartdevice.set_mode(2,2) test_util.count_down(10,lambda : print(uartdevice.get_value_byte(2)))
def test_ev3_ir_sensor(self): from ev3.lego import EV3IRSensor irSensor=EV3IRSensor(robot.SENSOR_4) print("IR prox mode") irSensor.set_prox_mode() test_util.count_down(10, lambda:print(irSensor.get_distance())) irSensor.set_seek_mode() print("IR seek mode. open beacon!!") test_util.count_down(10, lambda:print(irSensor.get_direction_and_distance(EV3IRSensor.CHANNEL_1))) print("IR remote mode. press beacon buttone!!") irSensor.set_remote_mode() test_util.count_down(10, lambda:print(irSensor.get_remote_command(EV3IRSensor.CHANNEL_1))) irSensor.reset()
def test_mindsensor_psp_sensor(self): from ev3.mindsensor import PSP pspSensor = PSP(robot.SENSOR_1) print("press up") test_util.count_down(3) test_util.wait(5, lambda:print(pspSensor.get_up())) print("press down") test_util.count_down(3) test_util.wait(5, lambda:print(pspSensor.get_down())) print("left stick") test_util.count_down(3) test_util.wait(5, lambda:print(pspSensor.get_x_left()))
def test_ev3_color_sensor(self): from ev3.lego import EV3ColorSensor colorSensor = EV3ColorSensor(robot.SENSOR_3) print( "start reflect mode") colorSensor.set_reflect_mode() test_util.count_down(10, lambda:print( colorSensor.get_value())) print ("start ambient mode") colorSensor.set_ambient_mode() test_util.count_down(10, lambda:print( colorSensor.get_value())) print( "start color mode") colorSensor.set_color_mode() test_util.count_down(10, lambda:print( colorSensor.color_to_string())) colorSensor.reset()
def test_ev3_touch_sensor(self): from ev3.lego import EV3TouchSensor touchSensor = EV3TouchSensor(robot.SENSOR_2) test_util.count_down(10, lambda:print(touchSensor.is_pressed()))
def test_hi_technc_compass(self): from ev3.hi_technc import HiTechncCompass compass = HiTechncCompass(robot.SENSOR_3, 0x02) print( "start compass test") test_util.count_down(10, lambda:print( compass.get_angle() ))