Other Arduino Codes and Videos by Robojax

Arduino code and Video for Dual Channel 5V Relay Robojax.com

This is the Arduino code for Dual Channel 5V Relay

This video shows you how to use control or connect 2 AC or DC load using Arduino and relay. http://robojax.com/learn/arduino/

 /*
 * This is the Arduino code for Dual Channel 5V Relay
 * to control turn ON or OFF AC or DC load. You can control 2 differen loads such as bulbs, or heater or other machine
 * Watch the video https://youtu.be/EclIomn_3dI
 *  * 
 * Written by Ahmad Nejrabi for Robojax Video
 * Date: Dec 26, 2017, in Ajax, Ontario, Canada
 * Permission granted to share this code given that this
 * note is kept with the code.
 * Disclaimer: this code is "AS IS" and for educational purpose only.
 * 
 */

void setup() {
  
  Serial.begin(9600);// setup Serial Monitor to display information
  pinMode(7, OUTPUT);// connected to Relay 1
  pinMode(8, OUTPUT);// connected to Relay 2

}

void loop() {
  digitalWrite(8, LOW); // turn relay 2 OFF 
      Serial.print("Pin 8 LOW");
  digitalWrite(7,HIGH);// turn relay 1 ON
      Serial.println(" Pin 7 HIGH");
  delay(3000);// keep in relay 2 OFF and relay 1 On for 3 seconds
  digitalWrite(7, LOW);// turn relay 1 OFF
  digitalWrite(8,HIGH);// turn relay 2 ON
      Serial.print("Pin 7 LOW");
      Serial.println(" Pin 8 HIGH");
  delay(3000);// keep in relay 1 OFF and relay 2 On for 3 seconds


}