Relay timing

Hello,

I'm new here and have been trying to code 2 relays to work independently at some times and together at others but it always seems to have a mind of it's own. They go on and of randomly. Any suggestions?

Post your code and your schematic.

Don’t post in a section of the forum labelled “don’t post your questions here”

HTH

TOPIC MOVED.

You may want to READ THIS for future reference. It will help you get the best out of the forum.

Bob.

We can only guess without seeing your code and connections but I'd immediately suspect you've got your switches wired in a way that is not compatible with the code you've got.

For example, your switches are wired so that when pressed, they connect a pin to 5V and you've got your pinMode() for each pin setup as "INPUT." Without external resistors the pins will float when the switch is not pressed, giving false readings and unpredictable behavior.

What Blackfin said plus from what you said in #2 here, probably drawing too much current from an i/o pin and maybe the board's resetting?

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html .
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks… Tom… :slight_smile: