In this project I experimented with color. This was a big leap because I used almost every sensor and technique we knew including conditions, loops and two different sensors. It is still a work in progress and has a few issues. What we were trying to do was when the color of the mat changes, the robot would perform different action. The problem is that the robot would run the program whenever it saw the color. So, it would just go in circles. I will eventually fix the problem, but here is what I have so far.
Here is a simplified version of the code above:
if color is blue then stop, go back and turn right
else if color us brown, stop, go back, turn left
else if color is red then, turn left, and continue going forward
else - do nothing.
if object is within 5 cm go back and turn the medium motor.
So far, this is not working as expected as this video shows - the sensor seems to get a little confused when it reaches a yellow mat. One other thing I need to fix is to activate the above conditions only when the mat color changes, and not while the robot is driving on the same color mat.