from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_D, LargeMotor, MediumMotor, InfraredSensor from ev3dev.auto import INPUT_1, INPUT_2, ColorSensor, UltrasonicSensor import time import ev3dev.auto as auto import ev3dev.ev3 as ev3 uss = UltrasonicSensor(INPUT_1) colorSensor = ColorSensor(INPUT_2) clawMotor = MediumMotor(OUTPUT_B) leftTire = LargeMotor(OUTPUT_A) # and LargeMotor(OUTPUT_D) rightTire = LargeMotor(OUTPUT_D) clawMotor.run_timed(speed_sp=720, time_sp=500) time.sleep(1)
motor_a = LargeMotor('outA') motor_b = LargeMotor('outB') motor_c = LargeMotor('outC') motor_d = LargeMotor('outD') motor_c.polarity = 'inversed' motor_d.polarity = 'inversed' motor_a.stop_action = 'brake' motor_b.stop_action = 'brake' motor_c.stop_action = 'brake' motor_d.stop_action = 'brake' color_sensor = ColorSensor() color_sensor.mode = 'COL-REFLECT' sonar_sensor = UltrasonicSensor() sonar_sensor.mode = 'US-DIST-CM' lights = Led() Led.delay_on = 500 Led.delay_off = 1500 lights.trigger = 'none' time_since_escline = 0 is_esc_line = False is_searching = False print('ready') lights.trigger = 'timer'
motor_a = LargeMotor('outA') motor_b = LargeMotor('outB') motor_c = LargeMotor('outC') motor_d = LargeMotor('outD') motor_c.polarity = 'inversed' motor_d.polarity = 'inversed' motor_a.stop_action = 'brake' motor_b.stop_action = 'brake' motor_c.stop_action = 'brake' motor_d.stop_action = 'brake' color_sensor = ColorSensor() color_sensor.mode = 'COL-REFLECT' sonar_sensor = UltrasonicSensor() sonar_sensor.mode = 'US-DIST-CM' lights = Led() Led.delay_on = 500 Led.delay_off = 1500 lights.trigger = 'none' time_since_escline = 0 is_esc_line = False is_searching = False print('ready') lights.trigger = 'timer' #input("Press enter to go!")