Created
October 6, 2014 08:13
-
-
Save jamesabruce/1e7787da5d8f0e1e49ba to your computer and use it in GitHub Desktop.
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
/* | |
Qyuick and dirty IR signal over i2c rebroadcast for | |
Lighting Cloud Mood Lamp By James Bruce | |
View the full tutorial and build guide at http://www.makeuseof.com/ | |
Used to get around the limitations of having two libraries that both require exact timings to work right! | |
*/ | |
#include <Wire.h> | |
#include <IRremote.h> | |
int RECV_PIN = 11; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; | |
void setup() | |
{ | |
Wire.begin(); // Start I2C Bus as Master | |
Serial.begin(115200); | |
irrecv.enableIRIn(); // Start the receiver | |
} | |
void loop() { | |
if (irrecv.decode(&results)) { | |
if(results.value != 0xFFFFFFFF){ | |
Serial.println(results.value,HEX); | |
//only transmit if its not a repeat value. theyre useless. you may need to | |
// adjust for your own remote repeat values | |
Wire.beginTransmission(9); | |
Wire.write(results.value); | |
Wire.endTransmission(); | |
} | |
irrecv.enableIRIn(); | |
irrecv.resume(); // Receive the next value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment