So here is the deal, I am trying to make an IR repeater, and the older version of this library (IRremote) uses results.value to get the IR value. But in order to send an IR signal, you need to use HEX. But it also needs to be in uint8_t variable.
Please help.
Here is my code. (It is just a hack job right now):
#include <IRremote.h>
int code;
IRsend irsend;
const int RECV_PIN = 12;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
switch (results.decode_type) {
case NEC: Serial.println("NEC");
code = NEC; break;
case SONY: Serial.println("SONY");
code = SONY; break;
case RC5: Serial.println("RC5");
code = RC5; break;
case RC6: Serial.println("RC6");
code = RC6; break;
case SHARP: Serial.println("SHARP");
code = SHARP; break;
case JVC: Serial.println("JVC");
code = JVC; break;
case SAMSUNG: Serial.println("SAMSUNG");
code = SAMSUNG; break;
case LG: Serial.println("LG");
code = LG; break;
case WHYNTER: Serial.println("WHYNTER");
code = WHYNTER; break;
case PANASONIC: Serial.println("PANASONIC");
code = PANASONIC; break;
case DENON: Serial.println("DENON");
code = DENON; break;
default:
case UNKNOWN: Serial.println("UNKNOWN");
code = UNKNOWN; break;
}
Serial.println(code);
irrecv.resume();
String sendData = "0x" + String(results.value, HEX);
sendCode(sendData);
}
}
void sendCode(uint8_t value){
switch (code){
case NEC:
irsend.sendNEC(value, 32);
case SONY:
irsend.sendSony(value, 32);
break;
case RC5:
irsend.sendRC5(value, 32);
break;
case RC6:
irsend.sendRC6(value, 32);
break;
case SHARP:
irsend.sendSharp(value, 32);
break;
case JVC:
irsend.sendJVC(value, 32);
break;
case SAMSUNG:
irsend.sendSamsung(value, 32);
break;
case WHYNTER:
irsend.sendWhynter(value, 32);
break;
case PANASONIC:
irsend.sendPanasonic(value, 32);
break;
case DENON:
irsend.sendDenon(value, 32);
break;
case LG:
irsend.sendLG(value, 32);
break;
case UNKNOWN:
irsend.send(value, 32);
break;
}
}