How to use 5V Relay to Turn ON and OFF AC Light bulb - Arduino Tutorial



This video shows you how to use 5V Relay module 1 channel for Arduino

Arduino Sketch


int relayPin = 7;
void setup() {
  // put your setup code here, to run once:
  pinMode(relayPin , OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(relayPin , HIGH ); // off Light
  delay(8000);
  digitalWrite(relayPin , LOW ); // On Light
  delay(8000);
}

ความคิดเห็น