Josh From
Published © CC BY-NC

Control Your Lights With Arduino And A Relay

Why use a relay module when plain relays are cheaper? We will show you how to control your lights with an Arduino.

BeginnerProtip1 hour46,917
Control Your Lights With Arduino And A Relay

Things used in this project


Read more




Code snippet #1

// BreakoutBros Relay Tutorial 
// 2016
//This tutorial is using the RoboRed Arduino from Yourduino
//Along with parts from the Elegoo Uno R3 Complete Starter Kit

void setup() {
 // initialize digital pin 3 as an output.
 pinMode(3, OUTPUT); 

//The main loop will continue to run until the arduino loses power
void loop() {
 digitalWrite(3, LOW); // turn the relay off to start
 delay(3000); // wait for 3 seconds
 digitalWrite(3, HIGH); // turn the relay on to turn on the light
 delay(3000); // wait for 3 seconds 


Josh From

Josh From

14 projects • 76 followers
At BreakoutBros we try to be a link between electronics designers and hobbyists. We make electronics tinkering easy for everyone but teach professional methods.