Skip to content

Instantly share code, notes, and snippets.

@csmatt
Created December 31, 2012 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csmatt/4422341 to your computer and use it in GitHub Desktop.
Save csmatt/4422341 to your computer and use it in GitHub Desktop.
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