Hi. I have an Arduino Uno, and I want to turn on and turn off led with my ir remote( its MP3 remote controller from some starter pack from DX). I'm using Ken Shiriff's IR libraries. My Arduino recieve impulses from controller, but I don't know how to write command to turn led on when I use some button. Thanks.
My Arduino recieve impulses from controller,
How do you know? Do you have some code, maybe with Serial.print() statements that proves this? If so, please do not use the invisible font when posting it.
TX led is flashing when I click something on controller, and log from serial monitor.
FFA25D
FFFFFFFF
FF629D
FFFFFFFF
FFE21D
FFFFFFFF
FF22DD
FFFFFFFF
FF02FD
FFC23D
FFFFFFFF
FFE01F
FFFFFFFF
FFA857
FFFFFFFF
FF906F
FFFFFFFF
FF6897
FFFFFFFF
FF9867
FFFFFFFF
FFB04F
FFFFFFFF
FF30CF
FFFFFFFF
FF18E7
FFFFFFFF
FF7A85
FFFFFFFF
FF10EF
FFFFFFFF
FF38C7
FFFFFFFF
FF5AA5
FFFFFFFF
FF42BD
FFFFFFFF
FF4AB5
FFFFFFFF
FF52AD
FFFFFFFF
TX led is flashing when I click something on controller, and log from serial monitor.
Well great, all you need to do is add a little code to turn the LED on or off. Maybe something after about line 92.
übernice, thank you.
I did ask you to post your code, so we could provide some specific help. You declined.
Sorry, I dont get it, when I was reading it... When you mentioned the code, I tried to downlaod another version of libraries direct from Shirriff's page, and now it's working. Anyway, thanks for help.
Now I'm trying to solve two problems.
- I want to turn on an turn off one led with same button.
-
I don't know how to describe it but eg. I want to turn on led1 and then led2 but I can choose just one led to turn on.- fixed with a bit of playing with code, but new problem is, one led lights normally, but the second lights just a bit
- I want to turn on an turn off one led with same button.
What is the problem? You keep track of the state of the LED. If it is HIGH and the right IR code arrives, make it LOW. If it is LOW and the right IR code arrives, make it HIGH.
- I don't know how to describe it but eg. I want to turn on led1 and then led2 but I can choose just one led to turn on.
When you know how to describe what you want to do, writing the code to make it happen will be a lot easier.
- I do know, about HIGH and LOW, but the problem is where to put the low...
void loop() {
if (irrecv.decode(&results)) {
switch (results.value) {
case 0xFFA25D:
break;
case 0xFF6897:
Serial.println("DGT0");
break;
case 0xFF30CF:
Serial.println("DGT1");
digitalWrite(latchPin, HIGH);
break;
case 0xFF18E7:
Serial.println("DGT2");
digitalWrite(latchPin1, HIGH);
break;
case 0xFF7A85:
Serial.println("DGT3");
break;
case 0xFF10EF:
Serial.println("DGT4");
break;
Serial.println("DGT5");
break;
case 0xFF5AA5:
Serial.println("DGT6");
break;
case 0xFF42BD:
Serial.println("DGT7");
break;
case 0xFF4AB5:
Serial.println("DGT8");
break;
case 0xFF52AD:
Serial.println("DGT9");
break;
}
shiftOut(dataPin,clkPin,MSBFIRST,digit);
irrecv.resume(); // Receive the next value
}