Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <IRremote.h>
  2.  
  3. int RECV_PIN = 11;
  4. int LED = 2;
  5. bool LED_ON = false;
  6. const long IRResult = 0xFFA25D;
  7.  
  8. IRrecv irrecv(RECV_PIN);
  9. decode_results results;
  10.  
  11. void setup()
  12. {
  13. Serial.begin(9600);
  14. pinMode(RECV_PIN, INPUT);
  15. pinMode(LED, OUTPUT);
  16. irrecv.enableIRIn();
  17. }
  18.  
  19. void loop()
  20. {
  21. if (irrecv.decode(&results))
  22. {
  23. Serial.println(results.value, HEX);
  24. irrecv.resume();
  25. if(results.value == IRResult)
  26. LED_ON = !LED_ON;
  27. }
  28. digitalWrite(LED, LED_ON);
  29. delay(100);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement