Advertisement
STANAANDREY

ir

Aug 2nd, 2022 (edited)
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include<IRremote.h>
  2.  
  3.  
  4. int recv_pin = 3;
  5. IRrecv receiver(recv_pin);
  6. decode_results results;
  7.  
  8. void setup()
  9. {
  10.    // put your setup code here, to run once:
  11.    Serial.begin(9600);
  12.    receiver.enableIRIn();
  13. }
  14.  
  15. void loop()
  16. {
  17.    // put your main code here, to run repeatedly:
  18.    if (receiver.decode(&results))  // ********  added &results (a place to store the key code)
  19.    {
  20.       Serial.println(results.value, HEX);
  21.       receiver.resume();
  22.    }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement