]> git.piffa.net Git - sketchbook_andrea/blob - hardware/Infrared_controller/basic_IR_reading_0/basic_IR_reading_0.ino
button state
[sketchbook_andrea] / hardware / Infrared_controller / basic_IR_reading_0 / basic_IR_reading_0.ino
1 // Remote infrared control
2 // http://www.instructables.com/id/Arduino-Infrared-Remote-tutorial/
3
4 // Requires library: https://github.com/shirriff/Arduino-IRremote
5 // Warning: DO NOT coonect the IR sensor to the Arduino without
6 // the PCB module
7
8 #include <IRremote.h>
9 #include <IRremoteInt.h>
10
11 int RECV_PIN = 11;
12 IRrecv irrecv(RECV_PIN);
13 decode_results results;
14
15 void setup()
16 {
17   Serial.begin(9600);
18   irrecv.enableIRIn(); // Start the receiver
19 }
20
21 void loop()
22 {
23   if (irrecv.decode(&results))
24     {
25      Serial.println(results.value, HEX);
26      if (results.value == 0xFF30CF) {
27        Serial.println("Uno");
28      }
29      irrecv.resume(); // Receive the next value
30     }
31 }
32
33