Remote controlled Lamp
I have made a remote-controlled lamp using Arduino UNO. It can be operated with any IR remote. TV remote, AC remote etc. will work. I have also made an enclosure for the lamp. I just took a transparent container and spray-painted that.
I have made a remote-controlled lamp using Arduino UNO. It can be operated with any IR remote. TV remote, AC remote etc. will work. I have also made an enclosure for the lamp. I just took a transparent container and spray-painted that.
Components:
Arduino UNO-R3 x 1
IR receiver 38Khz x 1
Blue LED x 1
Breadboard x 1
330-ohm resistor x 1
9V battery with connector x 1
Jumper wires
Connection:
| Arduino UNO | IR receiver module
| VCC | +
| GND | -
| 2 | Output
| Arduino UNO- R3 | Led
| GND | -
| 11 | + (Through 330 ohm resistor)
Code
Components:
Arduino UNO-R3 x 1
IR receiver 38Khz x 1
Blue LED x 1
Breadboard x 1
330-ohm resistor x 1
9V battery with connector x 1
Jumper wires
Connection:
| Arduino UNO | IR receiver module
| VCC | +
| GND | -
| 2 | Output
| Arduino UNO- R3 | Led
| GND | -
| 11 | + (Through 330 ohm resistor)
Code
// Make a Toggle IR Button
// Define the pins being used
int pinLed = 11;
int pinIR = 2;
// declaring variables to hold the new and old IR states
boolean oldIRState = LOW;
boolean newIRState = LOW;
boolean LEDstatus = LOW;
void setup()
{
Serial.begin(9600);
pinMode(pinLed, OUTPUT);
digitalWrite(pinLed, LOW);
pinMode(pinIR, INPUT);
}
void loop()
{
newIRState = digitalRead(pinIR);
if ( newIRState != oldIRState )//This is the condition when you press the remote
{
// has the button IR been closed?
if ( newIRState == HIGH )//Logic high in pin#2
{
if ( LEDstatus == LOW ) {//if LED is previously off
delay(200);
digitalWrite(pinLed, HIGH);
LEDstatus = HIGH;
}
else {
delay(200);
digitalWrite(pinLed, LOW);
LEDstatus = LOW;
}
}
oldIRState = newIRState;
}
}

Discussione (0 nota(e))