The attached PDF file is a program that I wrote in May 2019 to control my model railway switches (using servos) and their corresponding signals (using LED’s). The code is loaded on a Mega. The code has worked perfectly until I attempted to add an additional signal. The second signal identified as “yardLed2PinRED” should mimic “yardLedPinRED” and “yardLed2PinGRN” should mimic “yardLedPinGRN”. Both the led’s on signal 2, do not illuminate under any circumstance.
I have done the following to attempt to troubleshoot the problem.
Using an independent power supply, I checked the signal and the associated wiring right up to where it plugs into the Mega. The led’s light at both 3.3 volts and 5 volts.
Using “digitalRead”, I confirmed that the pins are going high and low as necessary. The original portions of the code still runs perfectly.
I can’t figure this out so I would appreciate any assistance.
Railway Signalling.pdf (40.7 KB)