Created
December 31, 2012 20:07
-
-
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.
This file contains hidden or 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> | |
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