The IR Puck can mimic arbitrary infrared remote controls. Built on the Puck IOT platform.
Dependencies: Puck IRSender mbed
The IR Puck is a puck that can mimic arbitrary infrared remote controls. This is useful for controlling things like TVs, radios, airconditioners, window blinds, and just about anything and everything that can be otherwise be controlled by a regular remote control.
A tutorial for the IR Puck is available on GitHub.
Tutorials and in-depth documentation for the Puck platform is available at the project's GitHub page
Diff: main.cpp
- Revision:
- 19:727d9124e11f
- Parent:
- 18:e96a99547f54
- Child:
- 21:b65729957b9e
--- a/main.cpp Wed Aug 06 13:29:51 2014 +0000 +++ b/main.cpp Fri Feb 27 18:53:06 2015 +0000 @@ -17,7 +17,7 @@ #include "mbed.h" #include "IRSender.h" -#define LOG_LEVEL_ERROR +#define LOG_LEVEL_INFO #include "Log.h" #include "Puck.h" @@ -38,13 +38,13 @@ #define COMMAND_BEGIN_CODE_TRANSMISSION 0 #define COMMAND_END_CODE_TRANSMISSION 1 -void onCommandWrite(uint8_t* value) { +void onCommandWrite(const uint8_t* value, uint8_t length) { switch(value[0]) { case COMMAND_BEGIN_CODE_TRANSMISSION: receiveIndex = 0; break; case COMMAND_END_CODE_TRANSMISSION: - puck->getBle().disconnect(); + puck->disconnect(); LOG_INFO("Going to fire IR code...\n"); irpin.irSeq(period, receiveIndex, dataBuffer); LOG_INFO("Fire complete!\n"); @@ -53,14 +53,14 @@ } -void onDataWrite(uint8_t* value) { - for(int i = 0; i < 20 && receiveIndex < DATA_BUFFER_SIZE; i += 2) { +void onDataWrite(const uint8_t* value, uint8_t length) { + for(int i = 0; i < 20 && receiveIndex < length; i += 2) { dataBuffer[receiveIndex++] = (value[i] << 8) | value[i + 1]; } } -void onPeriodWrite(uint8_t* value) { +void onPeriodWrite(const uint8_t* value, uint8_t length) { period = value[0]; }