Ev3 Color Sensor Python
thesantena opened this issue · 1 comments
thesantena commented
Hi. Pls. Help. How Can I do this action in python for ev3?
Run large motor on 30 speed. And wait for color sensor detected yellow color.When color sensor detected yellow color stop the motor. Thank you
WesleyJ-128 commented
#!/usr/bin/env python3
from ev3dev2.motor import LargeMotor
from ev3dev2.sensor.lego import ColorSensor
cs = ColorSensor()
lm = LargeMotor()
lm.on(30)
while not cs.color == cs.COLOR_YELLOW:
pass
lm.off()
Is just one way to do it.