October 25, 2019
Here is a snippet of code to use relay.
// Relay VCC to Arduino 5V
// Relay GND to Arduino GND
// Relay IN1 to Arduino 7
#define Relay 7
void setup() {
pinMode(Relay, OUTPUT);
}
void loop() {
digitalWrite(Relay, HIGH);
delay(1000);
digitalWrite(Relay, LOW);
delay(1000);
}
Do not forget to connect the circuit you wish to connect and discount to the relay.