Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://learn.adafruit.com/using-an-infrared-library/controlling-neopixels-with-ir-1
- #include <IRLib.h>
- unsigned long RCCode;
- unsigned int RCCodeH;
- unsigned int RCCodeL;
- IRrecv My_Receiver(11); // Receiver on pin 11
- IRdecode My_Decoder; // Decoder object
- //----------------------------
- void setup()
- {
- Serial.begin(9600);
- My_Receiver.enableIRIn(); // Start the receiver
- }
- //----------------------------
- void loop()
- {
- if (My_Receiver.GetResults(&My_Decoder))
- {
- My_Decoder.decode();
- // My_Decoder.decode_type = 1 = NEC, 7 = NECx
- if ((My_Decoder.decode_type == 1) || (My_Decoder.decode_type == 7))
- {
- if (My_Decoder.value != 0xFFFFFFFF) // Se não for o repic do botão
- {
- RCCode = My_Decoder.value;
- RCCodeH = RCCode>>8;
- RCCodeL = RCCode ;
- Serial.println(RCCode, HEX); // Print
- // Serial.println(RCCodeH, HEX); // Print
- // Serial.println(RCCodeL, HEX); // Print
- }
- }
- My_Receiver.resume(); // Restart the receiver
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement