Arduino Forum

Using Arduino => Sensors => Topic started by: New_coder on Dec 16, 2018, 09:32 am

Title: Defining Hex codes for IR sensor (Arduino UNO)
Post by: New_coder on Dec 16, 2018, 09:32 am
Pardon me, but I'm new to Arduino. I just started working on my IR sensor/remote and have managed to get all the hex codes for all my keys. However, instead of typing the hex codes into the code every time, I would like to save the codes in a separate library, so that I can include it into any IR-related projects. How can I do so? Please help ASAP

If you need the hex codes, here are the codes:
Code: [Select]
On/Off= FFA25D
VOL+=FF629D
FUNC/STOP=FFE21D
Rewind(|<<)=FF22DD
Play/Pause(||<)=FF02FD
FWD(>>|)=FFC23D
DOWN=FFE01F
VOL-=FFA857
UP=FF906F
0=FF6897
EQ=FF9867
ST/REPT=FFB04F
1=FF30CF
2=FF18E7
3=FF7A85
4=FF10EF
5=FF38C7
6=FF5AA5
7=FF42BD
8=FF4AB5
9=FF52AD

  
     
Title: Re: Defining Hex codes for IR sensor (Arduino UNO)
Post by: floresta on Dec 16, 2018, 02:40 pm
Please give us an example of how you are implementing some of those codes in a currently functioning program.

Don 

Title: Re: Defining Hex codes for IR sensor (Arduino UNO)
Post by: slipstick on Dec 16, 2018, 03:21 pm
If you don't want to type the codes you're going to have to give them names that you are willing to type and those in your list won't do...can you imagine the chaos you'd cause if you said that everywhere in your program that you type 1 it should be replaced by FF30CF?

Have a look at how note names to frequencies for tone() is done in pitches.h and then set up a similar set of defines for your codes. You don't need anything more than a .h file.

Steve