Arduino IR Remort Controlled Switch
2 Channel AC Switch Useing IR Remort Control
urce code
#include <IRremote.h>
?
int RECV_PIN = 11;?
?
String IRButton1 = "1FE50AF";//SWITCH 1?
?
String IRButton2 = "2D607981";//SWITCH 2?
?
?
?
const int ledPin1 = 4;// Relay 1?
?
const int ledPin2 = 5;// Relay 2?
?
?
?
?
IRrecv irrecv(RECV_PIN);?
?
?
decode_results results;?
?
String BUTTONPRESSED;?
?
int button1 = 0;?
?
int button2 = 0;?
?
?
?
void setup()?
?
{?
?
Serial.begin(9600);?
?
irrecv.enableIRIn(); // Start the receiver?
?
pinMode(ledPin1, OUTPUT);?
?
pinMode(ledPin2, OUTPUT);?
?
?
?
}?
?
?
void loop() {?
?
if (irrecv.decode(&results)) {?
?
Serial.println(results.value, HEX);?
?
BUTTONPRESSED = String(results.value, HEX);?
?
BUTTONPRESSED.toUpperCase();?
?
Serial.print("BUTTONPRESSED ");?
?
Serial.println(BUTTONPRESSED);?
?
//delay(1000);?
?
?
//button 1?
?
if (BUTTONPRESSED == IRButton1) ?
{?
?
if (button1 == 0) ?
{?
?
button1 = 1;?
?
}?
?
else?
?
button1 = 0;?
?
if (button1 == 1) ?
{?
?
digitalWrite(ledPin1, HIGH);?
?
?
?
?
?
?
}?
?
else?
?
digitalWrite(ledPin1, LOW);?
?
}?
?
?
//button 2?
?
if (BUTTONPRESSED == IRButton2) {?
?
if (button2 == 0) {?
?
button2 = 1;?
?
}?
?
else?
?
button2 = 0;?
?
if (button2 == 1) {?
?
digitalWrite(ledPin2, HIGH);?
?
?
?
}?
?
else?
?
digitalWrite(ledPin2, LOW);?
?
} ?
irrecv.resume(); // Receive the next value?
}?
}?
Arduino IR Remort Controlled Switch
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by sreeraj Sreeraj Krishna
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
55 0 0 -
-
-
-
Sega Master System RGB Encoder Switcher Z80 QSB v1.2
57 0 0 -
18650 2S2P Battery Charger, Protection and 5V Output Board
78 0 0 -
High Precision Thermal Imager + Infrared Thermometer | OpenTemp
420 0 6 -
Sony PlayStation Multi Output Frequency Oscillator (MOFO) v1
129 0 2