-
-
Save bengtmartensson/1ec8f5d31b6b88f8ea097fef72fe324a to your computer and use it in GitHub Desktop.
// This Arduino sketch was automatically generated by IrScrutinizer. | |
// It supports: | |
// | |
// * IRremote https://github.com/z3t0/Arduino-IRremote | |
// http://z3t0.github.io/Arduino-IRremote/ | |
// * IRLib https://github.com/cyborg5/IRLib | |
// * Infrared4Arduino https://github.com/bengtmartensson/Infrared4Arduino, | |
// http://www.harctoolbox.org/Infrared4Arduino.html (planned) | |
// For problems, bugs, and suggestions, please open an issue at | |
// https://github.com/bengtmartensson/harctoolboxbundle/issues | |
// This file contains C identifiers which have been translated from command names. | |
// Define exactly one of these | |
#define IRREMOTE | |
// #define IRLIB | |
// #define INFRARED4ARDUINO | |
///////////////////////////////////////////////////// | |
// Sanity check | |
#if defined(IRREMOTE) & ( defined(IRLIB) | defined(INFRARED4ARDUINO) ) | |
#error Must define only one of IRREMOTE, IRLIB, or INFRARED4ARDUINO | |
#endif | |
#if defined(IRLIB) & ( defined(IRREMOTE) | defined(INFRARED4ARDUINO) ) | |
#error Must define only one of IRREMOTE, IRLIB, or INFRARED4ARDUINO | |
#endif | |
#if defined(INFRARED4ARDUINO) & ( defined(IRLIB) | defined(IRREMOTE) ) | |
#error Must define only one of IRREMOTE, IRLIB, or INFRARED4ARDUINO | |
#endif | |
#ifdef IRREMOTE | |
#include <IRremote.h> | |
#elif defined(IRLIB) | |
#include <IRLib.h> | |
#define sendRaw send | |
#elif defined(INFRARED4ARDUINO) | |
#include <IrSenderPwm.h> | |
#else | |
#error Must defined one of IRREMOTE, IRLIB, or INFRARED4ARDUINO | |
#endif | |
#if defined(IRREMOTE) | defined(IRLIB) | |
typedef uint16_t microseconds_t; // Change if desired | |
typedef uint16_t frequency_t; // Change if desired | |
static inline unsigned hz2khz(frequency_t f) { return f/1000U; } | |
#endif | |
// Constants | |
static const long BAUD = 115200UL; // Change if desired | |
// Global variables | |
#ifdef IRREMOTE | |
IRsend irsend; | |
#elif defined(IRLIB) | |
IRsendRaw irsend; | |
#else | |
IrSender *irsend = IrSenderPwm::getInstance(true); | |
#endif | |
// Command #1: CHANNEL DOWN | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=33 | |
const microseconds_t repeat_CHANNEL_DOWN[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 65535U }; | |
// Command #2: CHANNEL UP | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=32 | |
const microseconds_t repeat_CHANNEL_UP[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 65535U }; | |
// Command #3: CURSOR DOWN | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=89 | |
const microseconds_t repeat_CURSOR_DOWN[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 65535U }; | |
// Command #4: CURSOR ENTER | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=92 | |
const microseconds_t repeat_CURSOR_ENTER[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 444U, 167U, 778U, 167U, 278U, 167U, 65535U }; | |
// Command #5: CURSOR LEFT | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=90 | |
const microseconds_t repeat_CURSOR_LEFT[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 444U, 167U, 611U, 167U, 611U, 167U, 65535U }; | |
// Command #6: CURSOR RIGHT | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=91 | |
const microseconds_t repeat_CURSOR_RIGHT[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 444U, 167U, 611U, 167U, 778U, 167U, 65535U }; | |
// Command #7: CURSOR UP | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=88 | |
const microseconds_t repeat_CURSOR_UP[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 65535U }; | |
// Command #8: DIGIT 0 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=0 | |
const microseconds_t repeat_DIGIT_0[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 65535U }; | |
// Command #9: DIGIT 1 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=1 | |
const microseconds_t repeat_DIGIT_1[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 65535U }; | |
// Command #10: DIGIT 2 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=2 | |
const microseconds_t repeat_DIGIT_2[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 65535U }; | |
// Command #11: DIGIT 3 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=3 | |
const microseconds_t repeat_DIGIT_3[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 778U, 167U, 65535U }; | |
// Command #12: DIGIT 4 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=4 | |
const microseconds_t repeat_DIGIT_4[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 278U, 167U, 65535U }; | |
// Command #13: DIGIT 5 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=5 | |
const microseconds_t repeat_DIGIT_5[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 444U, 167U, 65535U }; | |
// Command #14: DIGIT 6 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=6 | |
const microseconds_t repeat_DIGIT_6[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 611U, 167U, 65535U }; | |
// Command #15: DIGIT 7 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=7 | |
const microseconds_t repeat_DIGIT_7[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 778U, 167U, 65535U }; | |
// Command #16: DIGIT 8 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=8 | |
const microseconds_t repeat_DIGIT_8[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 278U, 167U, 65535U }; | |
// Command #17: DIGIT 9 | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=9 | |
const microseconds_t repeat_DIGIT_9[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 65535U }; | |
// Command #18: EXIT | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=21 | |
const microseconds_t repeat_EXIT[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 444U, 167U, 444U, 167U, 65535U }; | |
// Command #19: FAVORITE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=132 | |
const microseconds_t repeat_FAVORITE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 278U, 167U, 65535U }; | |
// Command #20: FORWARD | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=40 | |
const microseconds_t repeat_FORWARD[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 611U, 167U, 611U, 167U, 278U, 167U, 65535U }; | |
// Command #21: FUNCTION BLUE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=193 | |
const microseconds_t repeat_FUNCTION_BLUE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 778U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 65535U }; | |
// Command #22: FUNCTION GREEN | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=191 | |
const microseconds_t repeat_FUNCTION_GREEN[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 611U, 167U, 778U, 167U, 778U, 167U, 778U, 167U, 65535U }; | |
// Command #23: FUNCTION RED | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=190 | |
const microseconds_t repeat_FUNCTION_RED[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 611U, 167U, 778U, 167U, 778U, 167U, 611U, 167U, 65535U }; | |
// Command #24: FUNCTION YELLOW | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=192 | |
const microseconds_t repeat_FUNCTION_YELLOW[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 778U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 65535U }; | |
// Command #25: GAMES | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=22 | |
const microseconds_t repeat_GAMES[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 444U, 167U, 611U, 167U, 65535U }; | |
// Command #26: GUIDE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=129 | |
const microseconds_t repeat_GUIDE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 444U, 167U, 65535U }; | |
// Command #27: INFO | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=203 | |
const microseconds_t repeat_INFO[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 778U, 167U, 278U, 167U, 611U, 167U, 778U, 167U, 65535U }; | |
// Command #28: ITV | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=19 | |
const microseconds_t repeat_ITV[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 278U, 167U, 778U, 167U, 65535U }; | |
// Command #29: LIVE TV | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=18 | |
const microseconds_t repeat_LIVE_TV[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 278U, 167U, 611U, 167U, 65535U }; | |
// Command #30: MENU DVR | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=208 | |
const microseconds_t repeat_MENU_DVR[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 778U, 167U, 444U, 167U, 278U, 167U, 278U, 167U, 65535U }; | |
// Command #31: MENU MAIN | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=84 | |
const microseconds_t repeat_MENU_MAIN[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 444U, 167U, 444U, 167U, 444U, 167U, 278U, 167U, 65535U }; | |
// Command #32: MUTE TOGGLE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=13 | |
const microseconds_t repeat_MUTE_TOGGLE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 778U, 167U, 444U, 167U, 65535U }; | |
// Command #33: PAUSE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=48 | |
const microseconds_t repeat_PAUSE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 778U, 167U, 278U, 167U, 278U, 167U, 65535U }; | |
// Command #34: PLAY | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=44 | |
const microseconds_t repeat_PLAY[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 611U, 167U, 778U, 167U, 278U, 167U, 65535U }; | |
// Command #35: POWER TOGGLE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=12 | |
const microseconds_t repeat_POWER_TOGGLE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 778U, 167U, 278U, 167U, 65535U }; | |
// Command #36: PREVIOUS CHANNEL | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=131 | |
const microseconds_t repeat_PREVIOUS_CHANNEL[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 778U, 167U, 65535U }; | |
// Command #37: RECORD | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=55 | |
const microseconds_t repeat_RECORD[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 778U, 167U, 444U, 167U, 778U, 167U, 65535U }; | |
// Command #38: REVERSE | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=41 | |
const microseconds_t repeat_REVERSE[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 611U, 167U, 611U, 167U, 444U, 167U, 65535U }; | |
// Command #39: STOP | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=49 | |
const microseconds_t repeat_STOP[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 778U, 167U, 278U, 167U, 444U, 167U, 65535U }; | |
// Command #40: VOLUME DOWN | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=17 | |
const microseconds_t repeat_VOLUME_DOWN[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 278U, 167U, 444U, 167U, 65535U }; | |
// Command #41: VOLUME UP | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=16 | |
const microseconds_t repeat_VOLUME_UP[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 444U, 167U, 278U, 167U, 278U, 167U, 65535U }; | |
// Command #42: WIDGET | |
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=247 | |
const microseconds_t repeat_WIDGET[] PROGMEM = { 417U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 278U, 167U, 611U, 167U, 444U, 167U, 611U, 167U, 778U, 167U, 778U, 167U, 444U, 167U, 778U, 167U, 65535U }; | |
static void sendRaw(const microseconds_t intro_P[], size_t lengthIntro, const microseconds_t repeat_P[], | |
size_t lengthRepeat, frequency_t frequency, unsigned times) { | |
microseconds_t intro[lengthIntro]; | |
microseconds_t repeat[lengthRepeat]; | |
memcpy_PF(intro, (uint_farptr_t) intro_P, sizeof(microseconds_t) * lengthIntro); | |
memcpy_PF(repeat, (uint_farptr_t) repeat_P, sizeof(microseconds_t) * lengthRepeat); | |
#if defined(IRREMOTE) | defined(IRLIB) | |
if (lengthIntro > 0U) | |
irsend.sendRaw(intro, lengthIntro, hz2khz(frequency)); | |
if (lengthRepeat > 0U) | |
for (unsigned i = 0U; i < times - (lengthIntro > 0U); i++) | |
irsend.sendRaw(repeat, lengthRepeat, hz2khz(frequency)); | |
#else // INFRARED4ARDUINO | |
IrSignal irSignal(intro, lengthIntro, repeat, lengthRepeat, NULL, 0U, frequency); | |
irsend->sendIrSignal(irSignal, times); | |
#endif | |
} | |
void setup() { | |
Serial.begin(BAUD); | |
Serial.setTimeout(60000UL); | |
} | |
// A pretty silly main loop; just intended as an example. | |
void loop() { | |
Serial.println(F("Enter number of signal to send (1 .. 42)")); | |
long commandno = Serial.parseInt(); | |
Serial.println(F("Enter number of times to send it")); | |
long times = Serial.parseInt(); | |
switch (commandno) { | |
case 1U: | |
sendRaw(NULL, 0U, repeat_CHANNEL_DOWN, 36U, 36000U, times); | |
break; | |
case 2U: | |
sendRaw(NULL, 0U, repeat_CHANNEL_UP, 36U, 36000U, times); | |
break; | |
case 3U: | |
sendRaw(NULL, 0U, repeat_CURSOR_DOWN, 36U, 36000U, times); | |
break; | |
case 4U: | |
sendRaw(NULL, 0U, repeat_CURSOR_ENTER, 36U, 36000U, times); | |
break; | |
case 5U: | |
sendRaw(NULL, 0U, repeat_CURSOR_LEFT, 36U, 36000U, times); | |
break; | |
case 6U: | |
sendRaw(NULL, 0U, repeat_CURSOR_RIGHT, 36U, 36000U, times); | |
break; | |
case 7U: | |
sendRaw(NULL, 0U, repeat_CURSOR_UP, 36U, 36000U, times); | |
break; | |
case 8U: | |
sendRaw(NULL, 0U, repeat_DIGIT_0, 36U, 36000U, times); | |
break; | |
case 9U: | |
sendRaw(NULL, 0U, repeat_DIGIT_1, 36U, 36000U, times); | |
break; | |
case 10U: | |
sendRaw(NULL, 0U, repeat_DIGIT_2, 36U, 36000U, times); | |
break; | |
case 11U: | |
sendRaw(NULL, 0U, repeat_DIGIT_3, 36U, 36000U, times); | |
break; | |
case 12U: | |
sendRaw(NULL, 0U, repeat_DIGIT_4, 36U, 36000U, times); | |
break; | |
case 13U: | |
sendRaw(NULL, 0U, repeat_DIGIT_5, 36U, 36000U, times); | |
break; | |
case 14U: | |
sendRaw(NULL, 0U, repeat_DIGIT_6, 36U, 36000U, times); | |
break; | |
case 15U: | |
sendRaw(NULL, 0U, repeat_DIGIT_7, 36U, 36000U, times); | |
break; | |
case 16U: | |
sendRaw(NULL, 0U, repeat_DIGIT_8, 36U, 36000U, times); | |
break; | |
case 17U: | |
sendRaw(NULL, 0U, repeat_DIGIT_9, 36U, 36000U, times); | |
break; | |
case 18U: | |
sendRaw(NULL, 0U, repeat_EXIT, 36U, 36000U, times); | |
break; | |
case 19U: | |
sendRaw(NULL, 0U, repeat_FAVORITE, 36U, 36000U, times); | |
break; | |
case 20U: | |
sendRaw(NULL, 0U, repeat_FORWARD, 36U, 36000U, times); | |
break; | |
case 21U: | |
sendRaw(NULL, 0U, repeat_FUNCTION_BLUE, 36U, 36000U, times); | |
break; | |
case 22U: | |
sendRaw(NULL, 0U, repeat_FUNCTION_GREEN, 36U, 36000U, times); | |
break; | |
case 23U: | |
sendRaw(NULL, 0U, repeat_FUNCTION_RED, 36U, 36000U, times); | |
break; | |
case 24U: | |
sendRaw(NULL, 0U, repeat_FUNCTION_YELLOW, 36U, 36000U, times); | |
break; | |
case 25U: | |
sendRaw(NULL, 0U, repeat_GAMES, 36U, 36000U, times); | |
break; | |
case 26U: | |
sendRaw(NULL, 0U, repeat_GUIDE, 36U, 36000U, times); | |
break; | |
case 27U: | |
sendRaw(NULL, 0U, repeat_INFO, 36U, 36000U, times); | |
break; | |
case 28U: | |
sendRaw(NULL, 0U, repeat_ITV, 36U, 36000U, times); | |
break; | |
case 29U: | |
sendRaw(NULL, 0U, repeat_LIVE_TV, 36U, 36000U, times); | |
break; | |
case 30U: | |
sendRaw(NULL, 0U, repeat_MENU_DVR, 36U, 36000U, times); | |
break; | |
case 31U: | |
sendRaw(NULL, 0U, repeat_MENU_MAIN, 36U, 36000U, times); | |
break; | |
case 32U: | |
sendRaw(NULL, 0U, repeat_MUTE_TOGGLE, 36U, 36000U, times); | |
break; | |
case 33U: | |
sendRaw(NULL, 0U, repeat_PAUSE, 36U, 36000U, times); | |
break; | |
case 34U: | |
sendRaw(NULL, 0U, repeat_PLAY, 36U, 36000U, times); | |
break; | |
case 35U: | |
sendRaw(NULL, 0U, repeat_POWER_TOGGLE, 36U, 36000U, times); | |
break; | |
case 36U: | |
sendRaw(NULL, 0U, repeat_PREVIOUS_CHANNEL, 36U, 36000U, times); | |
break; | |
case 37U: | |
sendRaw(NULL, 0U, repeat_RECORD, 36U, 36000U, times); | |
break; | |
case 38U: | |
sendRaw(NULL, 0U, repeat_REVERSE, 36U, 36000U, times); | |
break; | |
case 39U: | |
sendRaw(NULL, 0U, repeat_STOP, 36U, 36000U, times); | |
break; | |
case 40U: | |
sendRaw(NULL, 0U, repeat_VOLUME_DOWN, 36U, 36000U, times); | |
break; | |
case 41U: | |
sendRaw(NULL, 0U, repeat_VOLUME_UP, 36U, 36000U, times); | |
break; | |
case 42U: | |
sendRaw(NULL, 0U, repeat_WIDGET, 36U, 36000U, times); | |
break; | |
default: | |
Serial.println(F("Invalid number entered, try again")); | |
break; | |
} | |
} |
Hi,
Thanks for the beautiful stuff. Can you provide the reverse logic of the program ? I mean, I need to detect which key is pressed on remote and act accordingly.
Thank you.
Hi, question: Can this be converted into a Irscrutinizer format (import ) again? :-)
There is no simple way
Hi, did you use TSOP1738 for finding out these codes?
Probably not. Someone posted a few codes and I generated code for it using IrScrutinizer. I do not find the original contribution.
For capturing iIR signals, I recommend this device + IrScrutinizer.
Hi,
Thanks for the beautiful stuff. Can you provide the reverse logic of the program ? I mean, I need to detect which key is pressed on remote and act accordingly.
Thank you.
Not exactly that program, but you can use Infrared4Arduino to write similar programs.
Probably not. Someone posted a few codes and I generated code for it using IrScrutinizer. I do not find the original contribution.
thank you so much for codes but i am having issue with it , i have to send it to 2 times to make it work
i am using with broad-link via home-assistant
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=12 (POWER toggle)
irgen -i raw -d +417,-278,+167,-278,+167,-611,+167,-444,+167,-611,+167,-278,+167,-278,+167,-278,+167,-278,+167,-278,+167,-611,+167,-444,+167,-611,+167,-278,+167,-278,+167,-778,+167,-278,+167,-89861 -o broadlink_base64
JgAmAA4JBQkFFAUPBRQFCQUJBQkFCQUJBRQFDwUUBQkFCQUaBQkFAAuHDQUAAAAAAAAAAAAAAAAAAAAA
with IrScrutinizer
JgAkAA4JBQkFFAUPBRQFCQUJBQkFCQUJBRQFDwUUBQkFCQUZBQkFAA0F
what parameters do i need to change to make it work in single click ?
i am using with broad-link via home-assistant
This is not related to the gist above.
But I suspect you can use IrScrutinizer and either its "Broadlink Python IR" export or the "Homeass-Broadlink IR" export to generate what you want.
But I suspect you can use IrScrutinizer and either its "Broadlink Python IR" export or the "Homeass-Broadlink IR" export to generate what you want.
yes its not related to gist but i have same remote , was not able to decode myself
this codes are working for my STB but i have to send it twice , used your export files
Broadlink Python IR and Homeass-Broadlink IR but still same
Hello,
Im building a smart remote controller for Airtel STB and could get most of it working - thanks to this code. However Im not able to send repeated digits. i.e if I send say 244 as channel number the STB receives only 24. All other keys and non repeating digits works perfectly so I don't think there is any issues such as IR LED being too close to the STB and so on. Can anyone on this forum help?
@ anooppadmanabhan ,
your STB is using IR commands with toggles, your program not.
Okay...Thank you... Can you tell me which bit is toggle bit for the Airtel STB code ?.
Can you tell me which bit is toggle bit for the Airtel STB code ?.
It is a bit (no pun intended!) more complicated than that. The Nokia32 protocol used has IRP form
{36k,1p,msb}<6,-10|6,-16|6,-22|6,-28>((15,-10,D:8,S:8,T:1,X:7,F:8,6,^100m)*,T=1-T) [D:0..255,S:0..255,F:0..255,T@:0..1=0,X:0..127]
so the toggle sits in "half a burst". You can use IrScrutinizer to generate the raw form. Or wait for bengtmartensson/IrScrutinizer#397
Okay... I dont have experience using IrScrutinizer or LIRC but I have been trying to capture raw codes using Ken Shirriff's IRDump2 and a 38Khz receiver. All I could get was random codes every time I press a button!. Thats probably due to the 38Khz receiver used for receiving 36Khz modulation may be?. Any help to insert toggle bit and transmit repeating numeric keys would help fix my project. Thanks in advance.
Okay... I dont have experience..
Can you share your project if possible ?
i am not sending directly via IR transmitter but using broadlink rm mini , i have to send value 2 time instantly only then stb do the action
might just make DIY IR blaster instead of rm mini so i can have more control using Home assistant
@bengtmartensson, thanks for the code.
I would like to implement the remote in nodemcu. while porting the code, I could not get working memcpy_PF function. Is there any equivalent libraries for nodemcu?
I want to use the below function in my sketch :
static void sendRaw(const microseconds_t intro_P[], size_t lengthIntro, const microseconds_t repeat_P[],
size_t lengthRepeat, frequency_t frequency, unsigned times) {
microseconds_t intro[lengthIntro];
microseconds_t repeat[lengthRepeat];
memcpy_PF(intro, (uint_farptr_t) intro_P, sizeof(microseconds_t) * lengthIntro);
memcpy_PF(repeat, (uint_farptr_t) repeat_P, sizeof(microseconds_t) * lengthRepeat);
#if defined(IRREMOTE) | defined(IRLIB)
if (lengthIntro > 0U)
irsend.sendRaw(intro, lengthIntro, hz2khz(frequency));
if (lengthRepeat > 0U)
for (unsigned i = 0U; i < times - (lengthIntro > 0U); i++)
irsend.sendRaw(repeat, lengthRepeat, hz2khz(frequency));
#else // INFRARED4ARDUINO
IrSignal irSignal(intro, lengthIntro, repeat, lengthRepeat, NULL, 0U, frequency);
irsend->sendIrSignal(irSignal, times);
#endif
}
Is there any equivalent libraries for nodemcu?
I do not know, but that is probably easy to find out. But if you have enough RAM memory (nodemcd probably has) you can put
the variables in normal RAM instead, and do not need the memcpy_PF transformation.
The just checked in IrScrutinizer snapshot generates (export: Arduino/Raw) code that supports boards without *_PF functions directly.
Okay... I dont have experience..
Can you share your project if possible ?
i am not sending directly via IR transmitter but using broadlink rm mini , i have to send value 2 time instantly only then stb do the action
might just make DIY IR blaster instead of rm mini so i can have more control using Home assistant
Here is my code. Im running on a Wemo D1 mini board with an IR LED connected to D7 through a BC547 NPN transistor. Code implements an HTTP server for use with a smart remote APP I wrote. It also operates a webseocket for receiving commands from sinric.com which emulates a TV device to Echo/Google Home. All features works as advertised except repeating numeric keys.
This code borrows heavily from https://github.com/kakopappa/sinric/blob/master/arduino_examples/tv_codec_ir_example.ino and https://gist.github.com/bengtmartensson/1ec8f5d31b6b88f8ea097fef72fe324a#file-arduino_raw_2017-07-17_08-58-29-ino
`#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <WiFiClient.h>
#include <WebSocketsClient.h>
#include <ArduinoJson.h>
#include <StreamString.h>
// Command #1: CHANNEL DOWN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=33
uint16_t repeat_CHANNEL_DOWN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 278, 167, 444, 167, 65535 };
// Command #2: CHANNEL UP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=32
uint16_t repeat_CHANNEL_UP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 278, 167, 278, 167, 65535 };
// Command #3: CURSOR DOWN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=89
uint16_t repeat_CURSOR_DOWN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 444, 167, 65535 };
// Command #4: CURSOR ENTER
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=92
uint16_t repeat_CURSOR_ENTER[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 778, 167, 278, 167, 65535 };
// Command #5: CURSOR LEFT
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=90
uint16_t repeat_CURSOR_LEFT[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 611, 167, 65535 };
// Command #6: CURSOR RIGHT
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=91
uint16_t repeat_CURSOR_RIGHT[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 778, 167, 65535 };
// Command #7: CURSOR UP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=88
uint16_t repeat_CURSOR_UP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 278, 167, 65535 };
// Command #8: DIGIT 0
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=0
uint16_t Key0[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 65535 };
// Command #9: DIGIT 1
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=1
uint16_t Key1[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 444, 167, 65535 };
// Command #10: DIGIT 2
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=2
uint16_t Key2[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 611, 167, 65535 };
//uint16_t Key2[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 611, 167, 65534 };
// Command #11: DIGIT 3
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=3
uint16_t Key3[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 778, 167, 65535 };
// Command #12: DIGIT 4
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=4
uint16_t Key4[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 278, 167, 65535 };
//uint16_t Key4end[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 278, 167, 65534 };
// Command #13: DIGIT 5
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=5
uint16_t Key5[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 444, 167, 65535 };
// Command #14: DIGIT 6
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=6
uint16_t Key6[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 611, 167, 65535 };
// Command #15: DIGIT 7
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=7
uint16_t Key7[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 778, 167, 65535 };
// Command #16: DIGIT 8
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=8
uint16_t Key8[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 611, 167, 278, 167, 65535 };
// Command #17: DIGIT 9
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=9
uint16_t Key9[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 611, 167, 444, 167, 65535 };
// Command #18: EXIT
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=21
uint16_t repeat_EXIT[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 444, 167, 444, 167, 65535 };
// Command #19: FAVORITE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=132
uint16_t repeat_FAVORITE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 278, 167, 444, 167, 278, 167, 65535 };
// Command #20: FORWARD
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=40
uint16_t repeat_FORWARD[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 611, 167, 278, 167, 65535 };
// Command #21: FUNCTION BLUE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=193
uint16_t repeat_FUNCTION_BLUE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 278, 167, 278, 167, 444, 167, 65535 };
// Command #22: FUNCTION GREEN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=191
uint16_t repeat_FUNCTION_GREEN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 778, 167, 778, 167, 778, 167, 65535 };
// Command #23: FUNCTION RED
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=190
uint16_t repeat_FUNCTION_RED[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 778, 167, 778, 167, 611, 167, 65535 };
// Command #24: FUNCTION YELLOW
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=192
uint16_t repeat_FUNCTION_YELLOW[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 278, 167, 278, 167, 278, 167, 65535 };
// Command #25: GAMES
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=22
uint16_t repeat_GAMES[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 444, 167, 611, 167, 65535 };
// Command #26: GUIDE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=129
uint16_t repeat_GUIDE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 278, 167, 278, 167, 444, 167, 65535 };
// Command #27: INFO
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=203
uint16_t repeat_INFO[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 278, 167, 611, 167, 778, 167, 65535 };
// Command #28: ITV
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=19
uint16_t repeat_ITV[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 778, 167, 65535 };
// Command #29: LIVE TV
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=18
uint16_t repeat_LIVE_TV[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 611, 167, 65535 };
// Command #30: MENU DVR
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=208
uint16_t repeat_MENU_DVR[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 444, 167, 278, 167, 278, 167, 65535 };
// Command #31: MENU MAIN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=84
uint16_t repeat_MENU_MAIN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 444, 167, 278, 167, 65535 };
// Command #32: MUTE TOGGLE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=13
uint16_t repeat_MUTE_TOGGLE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 778, 167, 444, 167, 65535 };
// Command #33: PAUSE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=48
uint16_t repeat_PAUSE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 778, 167, 278, 167, 278, 167, 65535 };
// Command #34: PLAY
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=44
uint16_t repeat_PLAY[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 778, 167, 278, 167, 65535 };
// Command #35: POWER TOGGLE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=12
uint16_t repeat_POWER_TOGGLE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 778, 167, 278, 167, 65535 };
// Command #36: PREVIOUS CHANNEL
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=131
uint16_t repeat_PREVIOUS_CHANNEL[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 278, 167, 278, 167, 778, 167, 65535 };
// Command #37: RECORD
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=55
uint16_t repeat_RECORD[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 778, 167, 444, 167, 778, 167, 65535 };
// Command #38: REVERSE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=41
uint16_t repeat_REVERSE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 611, 167, 444, 167, 65535 };
// Command #39: STOP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=49
uint16_t repeat_STOP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 778, 167, 278, 167, 444, 167, 65535 };
// Command #40: VOLUME DOWN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=17
uint16_t repeat_VOLUME_DOWN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 444, 167, 65535 };
// Command #41: VOLUME UP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=16
uint16_t repeat_VOLUME_UP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 278, 167, 65535 };
// Command #42: WIDGET
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=247
uint16_t repeat_WIDGET[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 778, 167, 444, 167, 778, 167, 65535 };
//Change this for Echo/Google Home voice support... should be in teh format "","channel number",...
const int num_channels = 28;
const String channels[] {"asianet","827",
"mazhavil manorama","831",
"Flowers TV","832",
"kairalee","834",
"jai maharashtra","849",
"amrita tv","836",
"DD Malayalam","871",
"we","837",
"sahara one","850",
"manorama news","851",
"asianet news","852",
"news 18","855",
"kappa tv","864",
"mathrubhumi news","853",
"twenty four","000",
"safari tv","868",
"people tv","854",
"janam tv","838",
"udaya comedy","839",
"HBO","246",
"movies now","250",
"sony pix","248",
"star world premiere hd","164",
"star world","166",
"star movies","244",
"star movies select hd","251",
"animal planet","427",
"fox life","425"};
const char* ssid = "";
const char* password = "";
MDNSResponder mdns;
ESP8266WebServer server(80);
//Sinric.com settings.
#define API_KEY "<SINRIC API KEY"; //Change to your sinric API Key. Your API Key is displayed on sinric.com dashboard
#define DEVICE_ID ""
#define SERVER_URL "iot.sinric.com"
#define SERVER_PORT 80
#define HEARTBEAT_INTERVAL 300000 // 5 Minutes
WebSocketsClient webSocket;
uint64_t heartbeatTimestamp = 0;
bool isConnected = false;
void webSocketEvent(WStype_t type, uint8_t * payload, size_t length);
//End Sinric settings
IRsend irsend(D7); // An IR LED is controlled by GPIO pin 4 (D2)
void setup() {
irsend.begin();
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}
server.on("/", {
Serial.println("HTTP client connected");
String cmd;
if ( server.arg("cmd") == "" ){ //Parameter not found
} else { //Parameter found
cmd = server.arg("cmd"); //Get IR cmd
Serial.println("Command received : " + cmd);
handleIr(cmd);
}
server.send(200, "text/plain", "OK");
});
server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
//Alexa connection through sinric.com
// server address, port and URL
webSocket.begin(SERVER_URL, SERVER_PORT, "/");
// event handler
webSocket.onEvent(webSocketEvent);
webSocket.setAuthorization("apikey", API_KEY);
// try again every 5000ms if connection has failed
webSocket.setReconnectInterval(5000); // If you see 'class WebSocketsClient' has no member named 'setReconnectInterval' error update arduinoWebSockets
}
String lookupChannel (String Channel ) {
for ( int i = 0 ; i < 2num_channels ; i+=2 ) {
if ( Channel == channels[i] ) {
return channels[i+1];
}
}
Serial.println("Channel lookup failed : " + Channel);
return "";
}
void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
switch (type) {
case WStype_DISCONNECTED:
isConnected = false;
Serial.printf("[webSocketEvent] Webservice disconnected from server!\n");
break;
case WStype_CONNECTED: {
isConnected = true;
Serial.printf("[webSocketEvent] Service connected to server at url: %s\n", payload);
Serial.printf("[webSocketEvent] Waiting for commands from server ...\n");
}
break;
case WStype_TEXT: {
Serial.printf("[webSocketEvent] get text: %s\n", payload);
#if ARDUINOJSON_VERSION_MAJOR == 5
DynamicJsonBuffer jsonBuffer;
JsonObject& json = jsonBuffer.parseObject((char)payload);
#endif
#if ARDUINOJSON_VERSION_MAJOR == 6
DynamicJsonDocument json(1024);
deserializeJson(json, (char*) payload);
#endif
String deviceId = json ["deviceId"];
String action = json ["action"];
Serial.print("Action : " + action);
if ( deviceId != DEVICE_ID ) {
Serial.println("Device id is not matching!\n");
return;
}
if (action == "setPowerState" ) {
// alexa, turn on tv ==> {"deviceId":"xx","action":"setPowerState","value":"ON"}
handleIr("STB_POWER");
} else if (action == "SetMute") {
// alexa, mute tv ==> {"deviceId":"xxx","action":"SetMute","value":{"mute":true}}
handleIr("MUTE");
} else if (action == "AdjustVolume") {
// alexa, turn the volume down on tv by 20 ==> {"deviceId":"xxx","action":"AdjustVolume","value":{"volume":-20,"volumeDefault":false}}
// alexa, lower the volume on tv ==> {"deviceId":"xx","action":"AdjustVolume","value":{"volume":-10,"volumeDefault":true}}
const char* kcvolume = json ["value"]["volume"];
bool kvdefault = json["value"]["volumeDefault"];
int volume = atoi(kcvolume);
} else if (action == "ChangeChannel") {
//alexa, change channel to 200 on tv ==> {"deviceId":"xx","action":"ChangeChannel","value":{"channel":{},"channelMetadata":{"name":"CH9-200"}}}
//alexa, change channel to pbs on tv ==> {"deviceId":"xx","action":"ChangeChannel","value":{"channel":{},"channelMetadata":{"name":"pbs"}}}
String Number = json ["value"]["channel"]["number"];
String Channel = json ["value"]["channelMetadata"]["name"];
if ( Channel != "" ) {
String Number = lookupChannel ( Channel );
if ( Number != "" ) {
Serial.println(" to : " + Channel);
setChannel ( Number );
}
} else if ( Number != "" ) {
Serial.println(" to : " + Number);
setChannel ( Number );
}
}
}
break;
case WStype_BIN:
Serial.printf("[webSocketEvent] get binary length: %u\n", length);
break;
default: break;
}
}
void handleIr(String cmd) {
if ( cmd == "CHU" ) {
irsend.sendRaw(repeat_CHANNEL_UP,36, 36);
} else if ( cmd == "CHD" ) {
irsend.sendRaw(repeat_CHANNEL_DOWN,36, 36);
} else if ( cmd == "VOLU" ) {
irsend.sendRaw(repeat_VOLUME_UP,36, 36);
} else if ( cmd == "VOLD" ) {
irsend.sendRaw(repeat_VOLUME_DOWN,36, 36);
} else if ( cmd == "MUTE" ) {
irsend.sendRaw(repeat_MUTE_TOGGLE,36, 36);
} else if ( cmd == "UP" ) {
irsend.sendRaw(repeat_CURSOR_UP,36, 36);
} else if ( cmd == "DOWN" ) {
irsend.sendRaw(repeat_CURSOR_DOWN,36, 36);
} else if ( cmd == "LEFT" ) {
irsend.sendRaw(repeat_CURSOR_LEFT,36, 36);
} else if ( cmd == "RIGHT" ) {
irsend.sendRaw(repeat_CURSOR_RIGHT,36, 36);
} else if ( cmd == "OK" ) {
irsend.sendRaw(repeat_CURSOR_ENTER,36, 36);
} else if ( cmd == "EXIT" ) {
irsend.sendRaw(repeat_EXIT,36, 36);
} else if ( cmd == "MENU" ) {
irsend.sendRaw(repeat_MENU_MAIN,36, 36);
} else if ( cmd == "BLUE" ) {
irsend.sendRaw(repeat_FUNCTION_BLUE,36, 36);
} else if ( cmd == "RED" ) {
irsend.sendRaw(repeat_FUNCTION_RED,36, 36);
} else if ( cmd == "GREEN" ) {
irsend.sendRaw(repeat_FUNCTION_GREEN,36, 36);
} else if ( cmd == "YELLOW" ) {
irsend.sendRaw(repeat_FUNCTION_YELLOW,36, 36);
} else if ( cmd == "PLAY" ) {
irsend.sendRaw(repeat_PLAY,36, 36);
} else if ( cmd == "PAUSE" ) {
irsend.sendRaw(repeat_PAUSE,36, 36);
} else if ( cmd == "REC" ) {
irsend.sendRaw(repeat_RECORD,36, 36);
} else if ( cmd == "REV" ) {
irsend.sendRaw(repeat_REVERSE,36, 36);
} else if ( cmd == "FWD" ) {
irsend.sendRaw(repeat_FORWARD,36, 36);
} else if ( cmd == "INFO" ) {
irsend.sendRaw(repeat_INFO,36, 36);
} else if ( cmd == "STB" ) {
irsend.sendRaw(repeat_POWER_TOGGLE,36, 36);
} else if ( cmd == "GUIDE" ) {
irsend.sendRaw(repeat_GUIDE,36, 36);
} else if ( cmd == "DVR" ) {
irsend.sendRaw(repeat_MENU_DVR,36, 36);
} else if ( cmd == "FAV" ) {
irsend.sendRaw(repeat_FAVORITE,36, 36);
} else {
//check if this is a channel number
if ( isDigit(cmd.charAt(0)) && isDigit(cmd.charAt(1)) && isDigit(cmd.charAt(2)) ) {
setChannel(cmd);
}
}
}
void setChannel ( String cmd ) {
Serial.println("Setting channel to " + cmd);
int cmd_delay = 300;//delay between key press...
for ( int i = 0 ; i < 3 ; i++ ) {
switch (cmd.charAt(i)) {
case '0':
irsend.sendRaw(Key0, 36, 36);
break;
case '1':
irsend.sendRaw(Key1, 36, 36);
break;
case '2':
irsend.sendRaw(Key2, 36, 36);
break;
case '3':
irsend.sendRaw(Key3, 36, 36);
break;
case '4':
irsend.sendRaw(Key4, 36, 36);
break;
case '5':
irsend.sendRaw(Key5, 36, 36);
break;
case '6':
irsend.sendRaw(Key6, 36, 36);
break;
case '7':
irsend.sendRaw(Key7, 36, 36);
break;
case '8':
irsend.sendRaw(Key8, 36, 36);
break;
case '9':
irsend.sendRaw(Key9, 36, 36);
break;
}
delay(cmd_delay);
}
}
void handleNotFound() {
server.send(200, "text/plain", "NOT_OK");
}
void loop() {
//http server for smart remote
server.handleClient();
//socket handler for Alexa through sinric.com
webSocket.loop();
if (isConnected) {
uint64_t now = millis();
// Send heartbeat in order to avoid disconnections during ISP resetting IPs over night. Thanks @MacSass
if ((now - heartbeatTimestamp) > HEARTBEAT_INTERVAL) {
heartbeatTimestamp = now;
webSocket.sendTXT("H");
}
}
}
`
@bengtmartensson thanks a lot for your comments. I could manage it without memcpy_PF. Cheers!
Is there any equivalent libraries for nodemcu?
I do not know, but that is probably easy to find out. But if you have enough RAM memory (nodemcd probably has) you can put
the variables in normal RAM instead, and do not need the memcpy_PF transformation.The just checked in IrScrutinizer snapshot generates (export: Arduino/Raw) code that supports boards without *_PF functions directly.
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <WiFiClient.h>#include <WebSocketsClient.h>
#include <ArduinoJson.h>
#include <StreamString.h>// Command #1: CHANNEL DOWN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=33
uint16_t repeat_CHANNEL_DOWN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 278, 167, 444, 167, 65535 };// Command #2: CHANNEL UP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=32
uint16_t repeat_CHANNEL_UP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 278, 167, 278, 167, 65535 };// Command #3: CURSOR DOWN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=89
uint16_t repeat_CURSOR_DOWN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 444, 167, 65535 };// Command #4: CURSOR ENTER
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=92
uint16_t repeat_CURSOR_ENTER[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 778, 167, 278, 167, 65535 };// Command #5: CURSOR LEFT
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=90
uint16_t repeat_CURSOR_LEFT[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 611, 167, 65535 };// Command #6: CURSOR RIGHT
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=91
uint16_t repeat_CURSOR_RIGHT[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 778, 167, 65535 };// Command #7: CURSOR UP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=88
uint16_t repeat_CURSOR_UP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 611, 167, 278, 167, 65535 };// Command #8: DIGIT 0
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=0
uint16_t Key0[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 65535 };// Command #9: DIGIT 1
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=1
uint16_t Key1[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 444, 167, 65535 };// Command #10: DIGIT 2
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=2
uint16_t Key2[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 611, 167, 65535 };
//uint16_t Key2[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 611, 167, 65534 };// Command #11: DIGIT 3
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=3
uint16_t Key3[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 778, 167, 65535 };// Command #12: DIGIT 4
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=4
uint16_t Key4[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 278, 167, 65535 };
//uint16_t Key4end[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 278, 167, 65534 };// Command #13: DIGIT 5
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=5
uint16_t Key5[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 444, 167, 65535 };// Command #14: DIGIT 6
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=6
uint16_t Key6[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 611, 167, 65535 };// Command #15: DIGIT 7
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=7
uint16_t Key7[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 444, 167, 778, 167, 65535 };// Command #16: DIGIT 8
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=8
uint16_t Key8[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 611, 167, 278, 167, 65535 };// Command #17: DIGIT 9
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=9
uint16_t Key9[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 611, 167, 444, 167, 65535 };// Command #18: EXIT
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=21
uint16_t repeat_EXIT[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 444, 167, 444, 167, 65535 };// Command #19: FAVORITE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=132
uint16_t repeat_FAVORITE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 278, 167, 444, 167, 278, 167, 65535 };// Command #20: FORWARD
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=40
uint16_t repeat_FORWARD[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 611, 167, 278, 167, 65535 };// Command #21: FUNCTION BLUE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=193
uint16_t repeat_FUNCTION_BLUE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 278, 167, 278, 167, 444, 167, 65535 };// Command #22: FUNCTION GREEN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=191
uint16_t repeat_FUNCTION_GREEN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 778, 167, 778, 167, 778, 167, 65535 };// Command #23: FUNCTION RED
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=190
uint16_t repeat_FUNCTION_RED[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 778, 167, 778, 167, 611, 167, 65535 };// Command #24: FUNCTION YELLOW
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=192
uint16_t repeat_FUNCTION_YELLOW[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 278, 167, 278, 167, 278, 167, 65535 };// Command #25: GAMES
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=22
uint16_t repeat_GAMES[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 444, 167, 611, 167, 65535 };// Command #26: GUIDE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=129
uint16_t repeat_GUIDE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 278, 167, 278, 167, 444, 167, 65535 };// Command #27: INFO
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=203
uint16_t repeat_INFO[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 278, 167, 611, 167, 778, 167, 65535 };// Command #28: ITV
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=19
uint16_t repeat_ITV[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 778, 167, 65535 };// Command #29: LIVE TV
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=18
uint16_t repeat_LIVE_TV[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 611, 167, 65535 };// Command #30: MENU DVR
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=208
uint16_t repeat_MENU_DVR[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 444, 167, 278, 167, 278, 167, 65535 };// Command #31: MENU MAIN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=84
uint16_t repeat_MENU_MAIN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 444, 167, 444, 167, 444, 167, 278, 167, 65535 };// Command #32: MUTE TOGGLE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=13
uint16_t repeat_MUTE_TOGGLE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 778, 167, 444, 167, 65535 };// Command #33: PAUSE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=48
uint16_t repeat_PAUSE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 778, 167, 278, 167, 278, 167, 65535 };// Command #34: PLAY
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=44
uint16_t repeat_PLAY[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 778, 167, 278, 167, 65535 };// Command #35: POWER TOGGLE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=12
uint16_t repeat_POWER_TOGGLE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 778, 167, 278, 167, 65535 };// Command #36: PREVIOUS CHANNEL
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=131
uint16_t repeat_PREVIOUS_CHANNEL[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 611, 167, 278, 167, 278, 167, 778, 167, 65535 };// Command #37: RECORD
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=55
uint16_t repeat_RECORD[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 778, 167, 444, 167, 778, 167, 65535 };// Command #38: REVERSE
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=41
uint16_t repeat_REVERSE[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 611, 167, 611, 167, 444, 167, 65535 };// Command #39: STOP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=49
uint16_t repeat_STOP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 778, 167, 278, 167, 444, 167, 65535 };// Command #40: VOLUME DOWN
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=17
uint16_t repeat_VOLUME_DOWN[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 444, 167, 65535 };// Command #41: VOLUME UP
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=16
uint16_t repeat_VOLUME_UP[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 444, 167, 278, 167, 278, 167, 65535 };// Command #42: WIDGET
// Protocol: nokia32, Parameters: X=38 S=0 D=38 T=0 F=247
uint16_t repeat_WIDGET[36] = { 417, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 278, 167, 278, 167, 278, 167, 278, 167, 278, 167, 611, 167, 444, 167, 611, 167, 778, 167, 778, 167, 444, 167, 778, 167, 65535 };//Change this for Echo/Google Home voice support... should be in teh format "","channel number",...
const int num_channels = 28;
const String channels[] {"asianet","827",
"mazhavil manorama","831",
"Flowers TV","832",
"kairalee","834",
"jai maharashtra","849",
"amrita tv","836",
"DD Malayalam","871",
"we","837",
"sahara one","850",
"manorama news","851",
"asianet news","852",
"news 18","855",
"kappa tv","864",
"mathrubhumi news","853",
"twenty four","000",
"safari tv","868",
"people tv","854",
"janam tv","838",
"udaya comedy","839",
"HBO","246",
"movies now","250",
"sony pix","248",
"star world premiere hd","164",
"star world","166",
"star movies","244",
"star movies select hd","251",
"animal planet","427",
"fox life","425"};const char* ssid = "";
const char* password = "";
MDNSResponder mdns;
ESP8266WebServer server(80);//Sinric.com settings.
#define API_KEY "<SINRIC API KEY"; //Change to your sinric API Key. Your API Key is displayed on sinric.com dashboard
#define DEVICE_ID ""
#define SERVER_URL "iot.sinric.com"
#define SERVER_PORT 80
#define HEARTBEAT_INTERVAL 300000 // 5 Minutes
WebSocketsClient webSocket;uint64_t heartbeatTimestamp = 0;
bool isConnected = false;void webSocketEvent(WStype_t type, uint8_t * payload, size_t length);
//End Sinric settingsIRsend irsend(D7); // An IR LED is controlled by GPIO pin 4 (D2)
void setup() {
irsend.begin();
Serial.begin(115200);WiFi.begin(ssid, password);
Serial.println("");// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
}server.on("/", {
Serial.println("HTTP client connected");
String cmd;
if ( server.arg("cmd") == "" ){ //Parameter not found
} else { //Parameter found
cmd = server.arg("cmd"); //Get IR cmd
Serial.println("Command received : " + cmd);
handleIr(cmd);
}
server.send(200, "text/plain", "OK");
});server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");//Alexa connection through sinric.com
// server address, port and URL
webSocket.begin(SERVER_URL, SERVER_PORT, "/");
// event handler
webSocket.onEvent(webSocketEvent);
webSocket.setAuthorization("apikey", API_KEY);
// try again every 5000ms if connection has failed
webSocket.setReconnectInterval(5000); // If you see 'class WebSocketsClient' has no member named 'setReconnectInterval' error update arduinoWebSockets
}String lookupChannel (String Channel ) {
for ( int i = 0 ; i < 2_num_channels ; i+=2 ) { if ( Channel == channels[i] ) { return channels[i+1]; } } Serial.println("Channel lookup failed : " + Channel); return ""; } void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) { switch (type) { case WStype_DISCONNECTED: isConnected = false; Serial.printf("[webSocketEvent] Webservice disconnected from server!\n"); break; case WStype_CONNECTED: { isConnected = true; Serial.printf("[webSocketEvent] Service connected to server at url: %s\n", payload); Serial.printf("[webSocketEvent] Waiting for commands from server ...\n"); } break; case WStype_TEXT: { Serial.printf("[webSocketEvent] get text: %s\n", payload); #if ARDUINOJSON_VERSION_MAJOR == 5 DynamicJsonBuffer jsonBuffer; JsonObject& json = jsonBuffer.parseObject((char_)payload);
#endif
#if ARDUINOJSON_VERSION_MAJOR == 6
DynamicJsonDocument json(1024);
deserializeJson(json, (char*) payload);
#endif
String deviceId = json ["deviceId"];
String action = json ["action"];
Serial.print("Action : " + action);
if ( deviceId != DEVICE_ID ) {
Serial.println("Device id is not matching!\n");
return;
}
if (action == "setPowerState" ) {
// alexa, turn on tv ==> {"deviceId":"xx","action":"setPowerState","value":"ON"}
handleIr("STB_POWER");
} else if (action == "SetMute") {
// alexa, mute tv ==> {"deviceId":"xxx","action":"SetMute","value":{"mute":true}}
handleIr("MUTE");
} else if (action == "AdjustVolume") {
// alexa, turn the volume down on tv by 20 ==> {"deviceId":"xxx","action":"AdjustVolume","value":{"volume":-20,"volumeDefault":false}}
// alexa, lower the volume on tv ==> {"deviceId":"xx","action":"AdjustVolume","value":{"volume":-10,"volumeDefault":true}}
const char* kcvolume = json ["value"]["volume"];
bool kvdefault = json["value"]["volumeDefault"];
int volume = atoi(kcvolume);
} else if (action == "ChangeChannel") {
//alexa, change channel to 200 on tv ==> {"deviceId":"xx","action":"ChangeChannel","value":{"channel":{},"channelMetadata":{"name":"CH9-200"}}}
//alexa, change channel to pbs on tv ==> {"deviceId":"xx","action":"ChangeChannel","value":{"channel":{},"channelMetadata":{"name":"pbs"}}}
String Number = json ["value"]["channel"]["number"];
String Channel = json ["value"]["channelMetadata"]["name"];
if ( Channel != "" ) {
String Number = lookupChannel ( Channel );
if ( Number != "" ) {
Serial.println(" to : " + Channel);
setChannel ( Number );
}
} else if ( Number != "" ) {
Serial.println(" to : " + Number);
setChannel ( Number );
}
}
}
break;
case WStype_BIN:
Serial.printf("[webSocketEvent] get binary length: %u\n", length);
break;
default: break;
}
}void handleIr(String cmd) {
if ( cmd == "CHU" ) {
irsend.sendRaw(repeat_CHANNEL_UP,36, 36);
} else if ( cmd == "CHD" ) {
irsend.sendRaw(repeat_CHANNEL_DOWN,36, 36);
} else if ( cmd == "VOLU" ) {
irsend.sendRaw(repeat_VOLUME_UP,36, 36);
} else if ( cmd == "VOLD" ) {
irsend.sendRaw(repeat_VOLUME_DOWN,36, 36);
} else if ( cmd == "MUTE" ) {
irsend.sendRaw(repeat_MUTE_TOGGLE,36, 36);
} else if ( cmd == "UP" ) {
irsend.sendRaw(repeat_CURSOR_UP,36, 36);
} else if ( cmd == "DOWN" ) {
irsend.sendRaw(repeat_CURSOR_DOWN,36, 36);
} else if ( cmd == "LEFT" ) {
irsend.sendRaw(repeat_CURSOR_LEFT,36, 36);
} else if ( cmd == "RIGHT" ) {
irsend.sendRaw(repeat_CURSOR_RIGHT,36, 36);
} else if ( cmd == "OK" ) {
irsend.sendRaw(repeat_CURSOR_ENTER,36, 36);
} else if ( cmd == "EXIT" ) {
irsend.sendRaw(repeat_EXIT,36, 36);
} else if ( cmd == "MENU" ) {
irsend.sendRaw(repeat_MENU_MAIN,36, 36);
} else if ( cmd == "BLUE" ) {
irsend.sendRaw(repeat_FUNCTION_BLUE,36, 36);
} else if ( cmd == "RED" ) {
irsend.sendRaw(repeat_FUNCTION_RED,36, 36);
} else if ( cmd == "GREEN" ) {
irsend.sendRaw(repeat_FUNCTION_GREEN,36, 36);
} else if ( cmd == "YELLOW" ) {
irsend.sendRaw(repeat_FUNCTION_YELLOW,36, 36);
} else if ( cmd == "PLAY" ) {
irsend.sendRaw(repeat_PLAY,36, 36);
} else if ( cmd == "PAUSE" ) {
irsend.sendRaw(repeat_PAUSE,36, 36);
} else if ( cmd == "REC" ) {
irsend.sendRaw(repeat_RECORD,36, 36);
} else if ( cmd == "REV" ) {
irsend.sendRaw(repeat_REVERSE,36, 36);
} else if ( cmd == "FWD" ) {
irsend.sendRaw(repeat_FORWARD,36, 36);
} else if ( cmd == "INFO" ) {
irsend.sendRaw(repeat_INFO,36, 36);
} else if ( cmd == "STB" ) {
irsend.sendRaw(repeat_POWER_TOGGLE,36, 36);
} else if ( cmd == "GUIDE" ) {
irsend.sendRaw(repeat_GUIDE,36, 36);
} else if ( cmd == "DVR" ) {
irsend.sendRaw(repeat_MENU_DVR,36, 36);
} else if ( cmd == "FAV" ) {
irsend.sendRaw(repeat_FAVORITE,36, 36);
} else {
//check if this is a channel number
if ( isDigit(cmd.charAt(0)) && isDigit(cmd.charAt(1)) && isDigit(cmd.charAt(2)) ) {
setChannel(cmd);
}
}
}void setChannel ( String cmd ) {
Serial.println("Setting channel to " + cmd);
int cmd_delay = 300;//delay between key press...
for ( int i = 0 ; i < 3 ; i++ ) {
switch (cmd.charAt(i)) {
case '0':
irsend.sendRaw(Key0, 36, 36);
break;
case '1':
irsend.sendRaw(Key1, 36, 36);
break;
case '2':
irsend.sendRaw(Key2, 36, 36);
break;
case '3':
irsend.sendRaw(Key3, 36, 36);
break;
case '4':
irsend.sendRaw(Key4, 36, 36);
break;
case '5':
irsend.sendRaw(Key5, 36, 36);
break;
case '6':
irsend.sendRaw(Key6, 36, 36);
break;
case '7':
irsend.sendRaw(Key7, 36, 36);
break;
case '8':
irsend.sendRaw(Key8, 36, 36);
break;
case '9':
irsend.sendRaw(Key9, 36, 36);
break;
}
delay(cmd_delay);
}
}
void handleNotFound() {
server.send(200, "text/plain", "NOT_OK");
}void loop() {
//http server for smart remote
server.handleClient();//socket handler for Alexa through sinric.com
webSocket.loop();
if (isConnected) {
uint64_t now = millis();
// Send heartbeat in order to avoid disconnections during ISP resetting IPs over night. Thanks @MacSass
if ((now - heartbeatTimestamp) > HEARTBEAT_INTERVAL) {
heartbeatTimestamp = now;
webSocket.sendTXT("H");
}
}
}
Thanks for posting this. Happy to see our local channels :)
What is your request?
I do not provide free private help. I provide freelancing consulting, for a professional hourly rate.
Hi, did you use TSOP1738 for finding out these codes?