Let's Save the Electricity

TLIOB005

Jugaadu's brother often leaves the table lamp ON after studying. Thus it consumes a lot of electricity. Jugaadu thought of doing something to solve this issue?
Digital Kit
  1. Place the IR sensors in front of the table facing the chair.
  2. Connect IR module with Arduino, Switch, battery and buzzer using connecting wires on the bread-board.
  3. Program the Arduino and upload the sketch Using A to B USB Cable.
  4. Test it by powering it on.

    

int out = 7;

int led=13;

void setup() {

// put your setup code here, to run once:

pinMode(out,INPUT);

pinMode(led,OUTPUT);

Serial.begin(9600);

}

void loop() {

// put your main code here, to run repeatedly:

if(digitalRead(out)==LOW)

{digitalWrite(led,HIGH);

Serial.println(out);

Serial.println("LIGHT ON");

}else{

digitalWrite(led,LOW);

Serial.println("LIGHT OFF");

} }