Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <tiny_IRremote.h>
- int RECV_PIN = 3; //infrared receiver
- int out = 0; //LED
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- void setup()
- {
- irrecv.enableIRIn(); // Start the receiver
- pinMode(out,OUTPUT);
- }
- void loop() {
- if (irrecv.decode(&results)) {
- // The value of the button on my remote is 1CE3926D
- if(results.value == 0x1CE3926D){
- if(digitalRead(out) == HIGH){
- digitalWrite(out,LOW);
- }
- else
- {
- digitalWrite(out,HIGH);
- }
- }
- irrecv.resume(); // Receive the next value
- }
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment