For this week’s project, I decided to build upon my initial Step Switch by stripping the middle connecting wire (which previously closed the circuit when contacted by a conductor) and creating two inputs that would be TRUE when my metallic sneakers came into contact with them. I also created a configuration of “traffic lights” that would have a different pattern depending on the input booleans.
This created two inputs for the project. When the circuit of my right foot input was closed on the board, the pattern of the traffic was slow, when the circuit of my left foot input was closed, the pattern was at a moderate speed, when both the left foot and right foot input circuits were closed, it would activate Crazy Mode™ where the lights would change at the fastest pace.
It was difficult to code my exit conditions if the state of the buttons changed. This was because the function would have to fully loop through if an input was TRUE, so I added return conditions at nearly every step of the process. I also wrote functions for each of the modes (slow, moderate, Crazy™) so my code was nearly 130 lines long with a few differences between the functions used.
Note: The aluminum sneakers will make a comeback during class today; I forgot them in my room when filming the video above.