N Gauge Forum

General Category => General Discussion => Topic started by: 1148Nick on November 24, 2019, 04:57:26 PM

Title: Arduino sketch writing for three aspect signals
Post by: 1148Nick on November 24, 2019, 04:57:26 PM
 :helpneededsign:
I am interested in using Nanos for automatically changing 3 aspect signals which would be activated by an IR obstacle avoidance sensor but I can't get a sketch to work. I would be grateful for some guidance on the matter, I basically want the green to show until the sensor is triggered then Red and after a delay yellow, then delay and green again.
Title: Re: Arduino sketch writing for three aspect signals
Post by: themadhippy on November 24, 2019, 05:08:01 PM
post up your code,for basic operation  you need to set 3 pins as outputs and 1 as an input,show the green output until the input changes then switch green off and red on,delay a bit switch green off yellow on ,delay a bit more and yellow off loop back to the start,the correct way would be to continuously monitor the input and regardless off the output state switch to red  when the input is triggered