Hi I am back:)
My project, a IR-Relay for a remote interfacing with 2 devices one is the TV another one is a Digispark-HID (with IR-Receiver, btw this already works). The main part is the Arduino nano as a receiver, handling the input from the remote(and later sending the desired IR-Signal to the other devices). For that I started with the code, which is supposed to receive the signal, and then for now just output the assigned "name" in the serial monitor. My next step is; getting the Arduino to send a specific IR value from my source(TV) remote.
My current attemt was, using this basic ir code dump to get the desired value:
#include <IRremote.h>
//#include <IRremoteInt.h>
int RECV_PIN = 2; // The digital pin that the signal pin of the sensor is connected to
IRrecv receiver(RECV_PIN); // Create a new receiver object that would decode signals to key codes
decode_results results; // A varuable that would be used by receiver to put the key code into
void setup() {
Serial.begin(9600); // Setup serial port to send key codes to computer
receiver.enableIRIn(); // Enable receiver so that it would start processing infrared signals
}
void loop() {
if(receiver.decode(&results)) { // Decode the button code and put it in "results" variable
Serial.println(results.value, HEX); // Print the code as a hexadecimal value
receiver.resume(); // Continue listening for new signals
}
}
So my values for the powerbutton are
E0E040BF
E0E06798
E0E06798
E0E040BF
right?
this results in
irsend.sendSAMSUNG(0xE0E040BF, 32);
irsend.sendSAMSUNG(0xE0E06798, 32);
irsend.sendSAMSUNG(0xE0E06798, 32);
irsend.sendSAMSUNG(0xE0E040BF, 32);
After the triggered case of the "POWER" the arduino lockes up, spits out the "---sent---" in sermon and doesn't accepts any further inputs.
My Code (Yes, my version of IRremote.h should support iresnd.sendSAMSUNG())
#include <IRremote.h>
const int SEND_PIN = 3;
const int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
int key_value;
void setup() {
pinMode(SEND_PIN, OUTPUT);
Serial.begin(9600);
Serial.println("Ready, when you are!");
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop() {
if (irrecv.decode(&results)) {
if (results.value == 0XFFFFFFFF)
results.value = key_value;
switch (results.value & ~0x800) {
case 0xC:
Serial.println("POWER");
irsend.sendSAMSUNG(0xE0E040BF, 32);
irsend.sendSAMSUNG(0xE0E06798, 32);
irsend.sendSAMSUNG(0xE0E06798, 32);
irsend.sendSAMSUNG(0xE0E040BF, 32);
Serial.println("---sent---");
break;
case 0x1:
Serial.println("1");
break;
case 0x2:
Serial.println("2");
break;
case 0x3:
Serial.println("3");
break;
case 0x4:
Serial.println("4");
break;
case 0x5:
Serial.println("5");
break;
case 0x6:
Serial.println("6");
break;
case 0x7:
Serial.println("7");
break;
case 0x8:
Serial.println("8");
break;
case 0x9:
Serial.println("9");
break;
case 0x0:
Serial.println("0");
break;
case 0x31:
Serial.println("FAV");
break;
case 0x3C:
Serial.println("TXT");
break;
case 0x37:
Serial.println("RED");
break;
case 0x36:
Serial.println("GREEN");
break;
case 0x32:
Serial.println("YELLOW");
break;
case 0x34:
Serial.println("BLUE");
break;
case 0x25:
Serial.println("GUIDE");
break;
case 0x33:
Serial.println("?");
break;
case 0x1B:
Serial.println("EXIT");
break;
case 0x19:
Serial.println("MENU");
break;
case 0x22:
Serial.println("BACK");
break;
case 0x1D:
Serial.println("TOOLS");
break;
case 0xF:
Serial.println("@");
break;
case 0x35:
Serial.println("OK");
break;
case 0x16:
Serial.println("UP");
break;
case 0x13:
Serial.println("LEFT");
break;
case 0x12:
Serial.println("RIGHT");
break;
case 0x17:
Serial.println("DOWN");
break;
case 0x10:
Serial.println("Vol_UP");
break;
case 0x11:
Serial.println("Vol_DOWN");
break;
case 0x38:
Serial.println("SRC");
break;
case 0xD:
Serial.println("MUTE");
break;
case 0x20:
Serial.println("PR_UP");
break;
case 0x21:
Serial.println("PR_DOWN");
break;
default:
Serial.println("New Input:");
Serial.println(results.value);
}
key_value = results.value;
irrecv.resume();
}
}
I checked with my phone cam; it sends some IR blast, but apparently not the correct one.
So:
Why does it lock up?
Is the irsend correct?
Please Help me if anyone has an idea or way around this issue!
Grundig_Fernbedienung_IRrecv.ino (3.1 KB)