Use color to control motors

My students are trying to set up code that allows the color detected by the optical sensor determine the speed at which the motors spin. Is this possible? What is the best formating?

Yep! Definitely possible!

You may want to use the hue detected by the optical to get a number, which you can then convert into a number on the scale of -100 to 100, or just get the color and a bunch of if/else statements to set speeds based on the closest color.

2 Likes