Create a gist now

Instantly share code, notes, and snippets.

Arduino program that receives an 8-byte command to be received by a Panasonic TV over infrared.
#include <IRremote.h>
IRsend irsend;
void setup() {
pinMode(3, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
while (Serial.available() > 7) {
union u_tag {
byte b[8];
unsigned long long ulval;
} u;
u.b[0] = Serial.read();
u.b[1] = Serial.read();
u.b[2] = Serial.read();
u.b[3] = Serial.read();
u.b[4] = Serial.read();
u.b[5] = Serial.read();
u.b[6] = Serial.read();
u.b[7] = Serial.read();
irsend.sendPanasonic(u.ulval, 48);
delay(1000);
Serial.flush();
}
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment