Arduino code and video for 4 channel Relay Shield
This is the Arduino code and video for 4 channel Relay Shield
This video shows you how to use control or connect AC or DC load using Arduino and relay. http://robojax.com/learn/arduino/
/*
* This is the Arduino code for 4 Relay Arduino Shield
* to control turn ON or OFF 4 AC or DC loads
* Watch the video https://youtu.be/u9q6cHj89b4
* *
* Written by Ahmad Nejrabi for Robojax Video
* Date: Dec 28, 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.
*
*/
// Recorded Dec 27, 2017 by Robojax
#define relay1 7
#define relay2 6
#define relay3 5
#define relay4 4
void setup() {
Serial.begin(9600);// setup Serial Monitor to display information
pinMode(relay1, OUTPUT);// connected to Relay 1
pinMode(relay2, OUTPUT);// connected to Relay 2
pinMode(relay3, OUTPUT);// connected to Relay 3
pinMode(relay4, OUTPUT);// connected to Relay 4
}
void loop() {
digitalWrite(relay3,HIGH);// turn relay 3 ON
Serial.println(" relay 3 ON");
delay(3000);// keep in relay 3 On for 3 seconds
digitalWrite(relay3, LOW);// turn relay 3 OFF
Serial.println(" relay 3 OFF");
delay(3000);// keep in relay 3 OFF for 3 seconds
}