204Views9Replies

Author Options:

Arduino IR remote to set a value Answered

Hello, I'm new here
I'm using an Arduino UNO with a VS1838B IR receiver and a remote control, I can receive signals perfectly and decode them, but I want like if I press a button, it's value goes to a variable, example: if I press "button 5" then an "OK button" a variable A=0 become A=5. 
Thanks

Discussions

0
None
gmoon

2 years ago

There are several ways to do this. One would be the switch/case statement, it's pretty straight-forward.

0
None
AYassineLebouiha

2 years ago

Thanks for support, I tried another methode, my project is actually temperature control, I have 2 actions cooling and heating, I acquire the ambient temperature and compare it to another constants, I want that the user select the temperature he wants, I think I will try to set the "A" with a value then modifying it with plus or minus button.
Thanks

0
None
Downunder35mAYassineLebouiha

Reply 2 years ago

See, with more info it is easier to get support, you should have included that in the initial question and maybe still a bit more ;)
If it is just about temperature control you might want to look into a dedicated controll like the REX100 and clones.
They only cost around 30 bucks and have the buttons, set functions and control already included.
As for coding you might want to simplify your approach.
Use some display code and variables to show up.
Add support for up and down button or an encoder knob while keeping the code working.
Now start adding the routines for temp control just as an independent block to work with fixed values - still keep the rest of the code working.
After all this replace the fixed values with your variables and it should work as expected.
Not sure where you got the idea of hex code but simple inputs and push buttons work just fine for this.

0
None
AYassineLebouihaDownunder35m

Reply 2 years ago

Actually, my project was to set the temperature in the arduino and then control the relays, but now we must let the user chose his own temperature interval or value.
I looked for the REX100, but our project must be based on Arduino and it's modules only.
It's okay now I've set the minimum value to a value1, and the maximum value to a value2, the user can modify them by incrementing or decrementing with a remote control then he press okay then the system start comparing the temperature from a sensor and start heating or cooling.
Thanks I'm new in this domain started working with arduino a month ago.

0
None
Downunder35mAYassineLebouiha

Reply 2 years ago

Then you might want to check the simulator 123D offers ;)
Get your circuit on the breadboard, connect to the Arduino and run your code.
Using the virtual world is sometimes easier than editing, uploading, rewiring...
Once it works in the simulator you simply transfer it to your real project ;)

0
None
Downunder35m

2 years ago

You need to understand and learn basic Arduino coding first before you modify programs.
IMHO you best bet is to start with the example sketches and to focus and working with variables and how to store/manipulate them.
Messing with code without knowing what you are actually doing usually only causes a lot of frustration...

0
None
AYassineLebouiha

2 years ago

Update:
I used this (( #define CH1 0x264C7D03 )) Button name(CH1, 1, 2 ....) and it's HEX code, and I could use them.
I will update if I get some other results