Hello
Ich verwende diesen Code, um von der simplen Arduino-Fernbedienung die Tastencodes zu empfangen:
if (IrReceiver.decode()) {
/*
* !!!Important!!! Enable receiving of the next value,
* since receiving has stopped after the end of the current received data packet.
*/
IrReceiver.resume(); // Enable receiving of the next value
if (IrReceiver.decodedIRData.command == 0xC) {
bright = 10;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x18) {
bright = 50;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x5E) {
bright = 100;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x08) {
bright = 150;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x1C) {
bright = 200;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x5A) {
bright = 255;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x16) {
Pixelschange(bright, 0, 0, 0);
} else if (IrReceiver.decodedIRData.command == 0x07) {
pixelsbar.setBrightness(5);
pixelsbar.show();
} else if (IrReceiver.decodedIRData.command == 0x09) {
pixelsbar.setBrightness(20);
pixelsbar.show();
} else if (IrReceiver.decodedIRData.command == 0x45) {
for (int i = 0; i < NUMPIXELSBAR; i++) {
pixelsbar.setPixelColor(i, pixelsbar.Color(0, 0, 0));
pixelsbar.show();
}
} else if (IrReceiver.decodedIRData.command == 0x52) {
rot = 0;
gruen = 255;
blau = 0;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x42) {
rot = 255;
gruen = 255;
blau = 255;
Pixelschange(bright, rot, gruen, blau);
} else if (IrReceiver.decodedIRData.command == 0x4A) {
rot = 255;
gruen = 140;
blau = 0;
Pixelschange(bright, rot, gruen, blau);
}
//Serial.println(IrReceiver.decodedIRData.command, HEX);
}
}
Das funktioniert auch, allerdings sendet meine LG-Fernbedienung teilweise die selben Codes.
Gibt es dafür eine Lösung oder läßt sich das nur mit einer manuell programmierbaren Fernbedienung lösen ?