At the beginning, I was unsure of how to do something ‘unexpected’ with some lights (disclaimer: I still don’t think this is unexpected enough but oh well). As I was crossing the road the other day, I noticed that people kept pressing that little button that was supposed to make the waiting time at the pedestrian crossing faster. I wondered if that actually had any effect on the time difference of the blinking of the traffic light.
I decided to try to create a circuit where, using a pentameter, could control the speed of the blinking of the traffic light. I began by setting up my circuit on the board.
I had my pentameter as an input at A0, my red light attached to the digital output 13, the yellow light at digital output 11, and the green light at digital output 9.
I struggled a little bit with the coding so I went back to the codes we did last class and watched the videos on Analog Input and Analog Output to try and comprehend how it could be done. I don’t think my code ended up being the most simple, but I tried to make it clear enough that I could understand each step, even though I’m sure that there are several extra parts that could be eliminated. My final code ended up looking like this:
In the end, this is how the circuit worked when plugged in with the code:
I think it would be really interesting to figure out much the ratio is between blinking lights at the traffic lights, and how to program the differences in the blinking of the lights.