Arduino Home automation system with the 8-chnnel relay


Now you do of course, realise that these relays are “active low”, so you must in setup(), firstly digitalWrite the pins controlling the relays to HIGH, then set them with pinMode to OUTPUT, otherwise they generally tend to flash on as the program starts up which in many or most cases, you do not want.

When you want to actuate a relay, you write that pin LOW.

That said, it is not helpful to attache your code as a “.ino” file. You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the “More → Modify” option below the right hand corner of your post - to mark up your code as such using the “</>” icon in the posting window. Just highlight each section of code (or output if you ever need to post that) from the IDE and click the icon.

In fact, the IDE has a “copy for forum” link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But don’t forget to use the “Auto-Format” (Ctrl-T) option first to make it easy to read. If you do not post it as “code” it can be quite garbled and is always more difficult to read.

It is inappropriate to attach it as a “.ino” file unless it is clearly too long to include in the post proper. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And that would also assume they are using a PC and have the IDE running on that PC.

Also tidy up blank space. Do use blank lines, but only between functional blocks.