p12_IRRemote.ino 582 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. Demo code for Project 12 - IRRemote
  3. * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
  4. * An IR detector/demodulator must be connected to the input RECV_PIN.
  5. updated by Maker Studio
  6. http://makerstudio.cc
  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. irrecv.enableIRIn(); // Start the receiver
  16. }
  17. void loop() {
  18. if (irrecv.decode(&results)) {
  19. Serial.println(results.value, HEX);//print received values
  20. irrecv.resume(); // Receive the next value
  21. }
  22. }