def makeLightSensor(port): try: s = ev3dev.LightSensor(port) except (AttributeError, OSError): logger.info('no light sensor connected to port [%s]' % port) s = None return s
def makeLightSensor(port): try: p = ev3dev.LegoPort(port) p.set_device = 'lego-nxt-light' s = ev3dev.LightSensor(port) except (AttributeError, OSError): logger.info('no light sensor connected to port [%s]', port) s = None return s
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')