Other Arduino Codes and Videos by Robojax
/*
Digispark Relay
Turn a bulb, AC or DC load ON/OFF
Written by Ahmad Shamshiri at 18:21 on Saturday May 11, 2019 for Robojax
in Ajax, Ontario, Canada
www.Robojax.com
Watch video instruction for this code: https://youtu.be/THgyVQE5yrA
*/
int relay = 0;// define a pin for relay output
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(relay, OUTPUT);// define "relay" as output
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(relay, LOW);// turn relay pin LOW (ON)
delay(300);// give it a little time (100ms)
digitalWrite(relay, HIGH);// turn relay pin HIGH (OFF)
delay(300);// give it a little time (100ms)
}
If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal