Programming Arduino to drive Relays

I got my second batch of parts in for my light controlling project. Last night I went to test the system out to see if it would work, but no dice. So, as of this point I have an Arduino Nano in the I2C Shield for Nano. This is run through a 6ft I2C cable into the I2C to IOT adapter which is plugged into an 8 Channel High Power 30A Relay board.
On my breadboard I was able to flip a switch on an input to the Arduino, which would then trigger an LED on the output, very simple. But now if I use the same code it will not trigger the relay on the board, nor turn the light on. So I’m going to assume that my code is wrong.
I am using the standard Arduino IDE as my programming environment. Any help at all would be highly appreciated.

You can use this code


This will turn on / off each relay.

Thanks

You guys are fantastic… Ill give this a try tonight if I can.

Writing to serial at various stages of your program is very useful for debugging. You can use the serial monitor in Arduino to see what is happening when. Just be careful not to use the pins occupied by I2C communication with the board.

1 Like