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
159 1 1 -
-