07 Mission Instructions
Your mission is to create a robot that counts how many times the lights are turned off and on each day for later analysis.
You have already completed many projects that use sensors to collect information about the world around your GoPiGo. So this time, we need to design a slightly more complicated program to respond to those sensors.
You already know how to write a program that does something when the light is on or off at the moment the GoPiGo checks the light sensor. This time, though, we need to write a program that constantly monitors the lights in the room and detects any change in their state: counting how many times the lights change from off to on and back again. We call this a state change.
Draw a state machine diagram for your design of this program on a piece of paper. Think about what the robot might be doing while the lights are staying in the same state.
Then, compare it to our diagram. Remember, your diagram doesn’t have to look exactly like ours to be right — there are many good ways to solve this problem.