Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lgacdecode.ino
#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
You can’t perform that action at this time.