Now we get to use these for some fun. We have our line follower robot kind of working, and it does have the LEDs underneath on the sensors, but we are now able to modify the line follower code to light up red when it it crosses the line and blue when it goes off the line.
Using the light strip for debugging the line follower robot
Line follower basic LEDs
First open up the line_following_behavior.py code from the last chapter. After the imports, add the following new code (in bold):
from robot import Robot
from time import sleep
cross_line_color = (255, 0, 0)
off_line_color = (0, 0, 255)
...
We've added a couple of preset colors. Note I've not used the color names here, but names for their purpose. I can then tune the...