Thread: Traffic Light
View Single Post
  #3  
Old 08-12-2021, 03:44 PM
dremu dremu is offline
Newbie
 
Join Date: Aug 2019
Posts: 101
dremu is on a distinguished road
Default Re: Traffic Light

Sweet!

I'm a big fan of the 'dweeno, use them in most of my projects to drive lighting or extra controls (not least as they're really easy to interface to my RX of choice, Flysky using iBus.)

Anyway, to your project, a thought would be that you could add switches (or magnetic sensors or whatever) for the streets, or crossing if you're doing rail, whatever. Most any dry sensor is easily added with pinMode(x, INPUT_PULLUP), and then you just digitalRead(x) to check it (okay, fine, you should debounce, but you get the idea, and there's tons of tutorials for that in detail.)

Then you can say "this busier street stays green until there's somebody stopped at the less busy side of the intersection" and go through the yellow-red for the main street, and then open up the side street, like thoroughfares work in the real world. We did this in an electronics tech class I took a bazillion years ago, before Arduinos were a thing. Fun thing was we had a guy there that worked for the state DOT, so he told us about how they cut into the tarmac to install the magnet sensors, etc, made it more real world and less just blinky lights.

Anyway, a thought. If you've already considered and/or know all this already, apologies, don't mean to talk down to anybody, I just tend to blather on some any time the word "microcontroller" appears =))

-- A
__________________
I mean, how hard can it be?
Reply With Quote