I was thinking that a daily device that everyone uses every day was a stop light. There’s multiple levels of complexity to it as well as it has to do with a couple timers which I am still trying to wrap my head around when theres is more than two things happening at once. My initial goal was to try and write this as an Arduino Library so that theoretically if someone has a Mega Arudino they would be able to set up a mini city grid.
Stop lights work on timers and sensors. There’s a generic timer that alternates the direction of the lights for traffic to flow at a regular interval. However if there’s a person waiting, or a car waiting there is a sensor that lets the system know this. When this message is received the default timer to switch the lights status is over written by a shorter wait time for the one who interacted with the sensor.
I was able to find a tutorial which helped me through the timer business. It was useful to have something complex as a reference. However I consistently ran into issues trying to get a library written.
A way to make this example more like a real stop light would be to add additional sensors for the cars. I was looking around to see what could maybe recognize a car waiting. Since real stop lights seem to use a magnet to detect cars I found this Spark Fun Hall Effect Sensor which is a magnetic switch and would probably do the trick.