30
30
Program
/*
It turns on and off a 220 V light bulb every 2 seconds, using,
a relay connected to the Arduino PIN 8
*/
int relayPin = 8;
// PIN to which the relay is connected
void setup() {
pinMode (relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
// Power
delay (2000);
digitalWrite(relayPin, LOW);
// Shutdown
delay (2000);
}