MicroPython Tutorial XIII

We did quite a few tutorials with the brick buttons and then switched to a more basic task, driving in a straight line. Lets focus on something different, something not present in the LEGO EDU kit the IR Remote and IR Sensor.

You need two lines to build an IR Sensor into your python code.

from pybricks.ev3devices import Motor, InfraredSensor
infra = InfraredSensor(Port.S4)

The first line simply names the class with the details of the device. The second defines the physical place the sensor is plugged into your brick.