Beispiel #1
0
 def makeTouchSensor(port):
     try:
         s = ev3dev.TouchSensor(port)
     except (AttributeError, OSError):
         logger.info('no touch sensor connected to port [%s]', port)
         s = None
     return s
    def __init__(self):
        self.steer_motor = ev3.LargeMotor(ev3.OUTPUT_B)
        self.drive_motor = ev3.MediumMotor(ev3.OUTPUT_A)
        threading.Thread.__init__(self)

        # Calibrate
        touch_sensor = ev3.TouchSensor(ev3.INPUT_1)
        while not touch_sensor.pressed:
            self.steer_motor.run_forever(speed_sp=-100)
        self.steer_motor.position = -30
        self.steer_motor.stop()
Beispiel #3
0
import ev3dev.auto as ev3
us = ev3.UltrasonicSensor('pistorm:BAS1')
ts = ev3.TouchSensor('pistorm:BBS1')
ls = ev3.LightSensor('pistorm:BAS2')
rs = ev3.LightSensor('pistorm:BBS2')
cm = ev3.LargeMotor('pistorm:BBM1')
lm = ev3.LargeMotor('pistorm:BAM2')
rm = ev3.LargeMotor('pistorm:BBM2')
 def __init__(self):
     self.medium_motor = ev3.MediumMotor(ev3.OUTPUT_A)
     self.touch_sensor = ev3.TouchSensor(ev3.INPUT_1)
     threading.Thread.__init__(self)