I’m trying to rig a few IR proximity sensors on a train layout, ie when the train goes by, the sensor fires one of two loops: one fires 2 12v relays I’m using as a flasher for a crossing signal, the second fires a small servo.
It ran fine for a couple of runs, then got super buggy. All that happens when I turn on arduino is the flasher loop keeps running and won’t stop. So I commented out everything but the 12v flasher relay combo and the ir sensor and it still loops the flasher code without stopping.
I don’t think I have a setup issue because it all worked initially.
I’d post my layout, but don’t see a way to post pics in this forum. Code is below.
Thanx for your help!!
Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE
The Arduino is not a power supply. Sounds like there may be a power problem. How are the relay coils and servo powered?
Please post a schematic. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.
do the inputs need to be configured as INPUT_PULLUP with internal pullup resistors?
it's not uncommon for the output os such detectors to simply be a transistor that pulls low so that they can be used with a variety of circuity operating at different voltages