Created
May 8, 2019 05:11
-
-
Save elktros/a12d1752bb63720e0656f59db89c0c26 to your computer and use it in GitHub Desktop.
Code for decoding IR Remote Signals using Arduino.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <IRremote.h> | |
IRrecv receiver(2); | |
decode_results results; | |
void setup() | |
{ | |
Serial.begin(9600); | |
receiver.enableIRIn(); // start receiving signals | |
} | |
void loop() | |
{ | |
if(receiver.decode(&results)) | |
{ | |
Serial.println(results.value, HEX); | |
Serial.print(results.rawlen - 1); | |
for(int i = 1; i < results.rawlen; i++) | |
{ | |
unsigned int num = results.rawbuf[i] * USECPERTICK; | |
Serial.print(","); | |
Serial.print(num); | |
} | |
Serial.println(""); | |
receiver.resume(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment