You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
726B

  1. /*
  2. * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
  3. * An IR detector/demodulator must be connected to the input RECV_PIN.
  4. * Version 0.1 July, 2009
  5. * Copyright 2009 Ken Shirriff
  6. * http://arcfn.com
  7. */
  8. #include <IRremote.h>
  9. int RECV_PIN = 11;
  10. IRrecv irrecv(RECV_PIN);
  11. decode_results results;
  12. void setup()
  13. {
  14. Serial.begin(9600);
  15. // In case the interrupt driver crashes on setup, give a clue
  16. // to the user what's going on.
  17. Serial.println("Enabling IRin");
  18. irrecv.enableIRIn(); // Start the receiver
  19. Serial.println("Enabled IRin");
  20. }
  21. void loop() {
  22. if (irrecv.decode(&results)) {
  23. Serial.println(results.value, HEX);
  24. irrecv.resume(); // Receive the next value
  25. }
  26. delay(100);
  27. }