Learning IR codes and storing in external eeprom.

Hello. Im searching for some libraries to learn IR codes from different remote controlers like RC5,RC6,SONY,NEC,APPLE.

What I need to do:

  1. Power on arduino
  2. Press Switch1 to start learning
  3. "Learn LED" is blinking - now I should press first key to learn, second key, thirt... and others and store them in external eeprom.
  4. If You press again Switch1 all data will be deleted and new remote control can be added.

Now I have only one remote control (codes from remote control I have added permanently in sketch). But I would like to learn different remote control - its more universal.

Now Im using this library GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols

Regards

Alright, show it!

And I think the IRrecord example of the library is a good start :slight_smile:

About code:

#include <IRremote.h>
#define irPin 8  // pin dla TSOP

IRrecv irrecv(irPin);
decode_results results;

void setup() {

 
     irrecv.enableIRIn();

   pinMode(PodswietleniePin, OUTPUT);
   pinMode(VolUpPin, OUTPUT);
   pinMode(VolDownPin, OUTPUT);

   digitalWrite(9, LOW); //podswietelnie potencjometru
   digitalWrite(10, LOW); //VolUp
   digitalWrite(A1, LOW); //VolDown




}


void loop() {




if (irrecv.decode(&results))
   {
       switch (results.value)
       {
         
         case 0x11:  // kod klawisza VOL+
            digitalWrite(VolUpPin, LOW);
            delay(250);
            digitalWrite(VolDownPin, LOW);
            break;
            
         case 0x811:  // kod klawisza VOL+
            digitalWrite(VolUpPin, HIGH);
            delay(250);
            digitalWrite(VolUpPin, LOW);
            break;
            
         case 0x10:  // kod klawisza VOL-
            digitalWrite(VolDownPin, LOW);
            delay(250);
            digitalWrite(VolUpPin, LOW);
            break;
            
         case 0x810:  // kod klawisza VOL-
            digitalWrite(VolDownPin, HIGH);
            delay(250);
            digitalWrite(VolDownPin, LOW);
            break;
            
         case 0x805:  // kod klawisza 5
             digitalWrite(PodswietleniePin, LOW);
            break;
            
         case 0x5:  // kod klawisza 5
             digitalWrite(PodswietleniePin, HIGH);
            break;

         }
   irrecv.resume();
   }


}

Nothing special :slight_smile:

Except from the pore indentation and

overdose of

blank lines. :wink: First can be fixed by pressing Ctrl+T in the IDE.

Did you take a look study the example I mentioned?

I saw this, today I will try to add to my sketch and tests.