Skip to content

Instantly share code, notes, and snippets.

@goura
Created July 29, 2017 17:39
Show Gist options
  • Save goura/7853d4bf657c34bcb08b77305be66b62 to your computer and use it in GitHub Desktop.
Save goura/7853d4bf657c34bcb08b77305be66b62 to your computer and use it in GitHub Desktop.
Arduino sketch to relay Toshiba REGZA remote signal to LE-5050TS4K-BK (Donki Generic Regza)
/*
* Arduino sketch to relay Toshiba REGZA remote signal
* to LE-5050TS4K-BK (Donki Generic Regza)
*/
// Uses IRLib2 https://github.com/cyborg5/IRLib2/
#include "IRLibAll.h"
// IR Receiver input is at pin 2 (this can be changed)
static const int RECEIVER_PIN = 2;
// IR LED output is pin 3 for Uno (this is fixed per each board)
static const int SENDER_PIN = 3;
IRrecvPCI myReceiver(RECEIVER_PIN);
IRdecode myDecoder;
IRsend mySender;
void setup() {
pinMode(SENDER_PIN, OUTPUT);
digitalWrite(SENDER_PIN, LOW);
Serial.begin(9600);
delay(2000); while(!Serial);
myReceiver.enableIRIn();
Serial.println(F("Ready"));
}
void loop() {
if (myReceiver.getResults()) {
myDecoder.decode();
myDecoder.dumpResults(true);
uint32_t value = myDecoder.value;
uint16_t vendor = value >> 16;
uint16_t instruction = value;
Serial.println("------------");
Serial.print("Received value: ");
Serial.println(myDecoder.value, HEX);
Serial.print("Vendor code: ");
Serial.print(vendor, HEX);
Serial.print(" Instruction: ");
Serial.println(instruction, HEX);
if (vendor == 0x02fd) { // 0x02fd is REGZA remote
Serial.print("Sending ");
// Code length is 32 bits
uint32_t sendValue = 0;
// High 16 bits are 0x0157 (Donki Generic Regza)
sendValue = sendValue | 0x0157;
sendValue = sendValue << 16;
// Low 16 bits are the same as received
sendValue = sendValue | instruction;
Serial.print(sendValue, HEX);
mySender.send(NEC, sendValue, 32);
Serial.println(" done.");
}
myReceiver.enableIRIn();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment