Created
June 24, 2016 13:34
-
-
Save chaeplin/49fb927d8021acbcb6d8b674fd59d986 to your computer and use it in GitHub Desktop.
lgacdecode.ino
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 <IRremoteESP8266.h> | |
//#include <IRremote.h> | |
int RECV_PIN = 14; | |
IRrecv irrecv(RECV_PIN); | |
void setup ( ) | |
{ | |
Serial.begin(115200); | |
irrecv.enableIRIn(); | |
} | |
void dumpInfo(decode_results *results) | |
{ | |
if (results->bits == 28 || results->bits == 32) | |
{ | |
Serial.print("bits :"); | |
Serial.print(results->bits); | |
Serial.print(" "); | |
for (int i = 3; i < results->rawlen; i++) { | |
unsigned long x = results->rawbuf[i] * USECPERTICK; | |
if (!(i & 1)) | |
{ | |
if ( x > 1000) | |
{ | |
Serial.print("1"); | |
} | |
else | |
{ | |
Serial.print("0"); | |
} | |
if ( ((i - 2) % 8 ) == 0 ) { | |
Serial.print(" "); | |
} | |
} | |
} | |
Serial.println(""); | |
} | |
delay(10); | |
irrecv.resume(); | |
} | |
void loop() | |
{ | |
decode_results results; | |
if (irrecv.decode(&results)) { | |
dumpInfo(&results); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment