Learn 2: Build and Calibrate

4. Instantiating

We are now ready to create instances of the line follower and color sensor classes and give them the names line_follower and color_sensor for ease of reference later on.

# initialize the light & color sensor (attached to an I2C port)
color_sensor = courier.init_light_color_sensor(led_state = True)

# initialize the line following sensor (attached to an I2C port)
line_follower = courier.init_line_follower()

Type the above code into the Sensor Setup Code cell in the template notebook and select Run Selected Cell to set up your sensor.

          • Run this cell right away.