Guest User

Arduino IR sample code

a guest
Apr 1st, 2013
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <IRremote.h>
  2.  
  3.  
  4.  
  5. int irPin = 2;
  6. IRrecv irrecv(irPin);
  7. decode_results results;
  8.  
  9. void setup(){
  10.  
  11.   Serial.begin(9600);
  12.   irrecv.enableIRIn();
  13. }
  14.  
  15. void loop(){
  16.  
  17.   if (irrecv.decode(&results)){
  18.  
  19.     Serial.println(results.value, BIN);
  20.     delay(1);
  21.     irrecv.resume();
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment