How to use IR remote with Arduino LCD menu?

Does anyone know how to edit an Arduino LCD menu sketch to work with an IR remote control instead of using 4 physical buttons? I'm using this menu http://www.coagula.org/content/pages/tutorial-manage-menu-and-lcd-display-arduino but I have troubles in editing the code to use the IR remote control...I'm pretty n00b at programming so I need your help guys... Cheers!

sort by: active | newest | oldest
you need to have an ir sensor, and code to read from that.

Take a look here

http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html this is how I got mine working :)
+1

Get your ir sensor working separately, then put the two sketches together, whenever IR 'key up' would do something, make it call the button press function of the original lcd sketch.
Timofte Andrei (author)  frollard4 years ago
believe me I've tried to combine the sketches but there is something missing. it's about allocating each code received by the sensor to each of the four buttons... it's not hard but it's killing me inside...
just find the code that would be called when a button is pressed, and call that code.
I just looked at the liquidcrystal library, and it doesnt use any spi, i2c, or pwm's that i could see... the ir library should work just fine, just make sure its not on a pin thats being used by the lcd. start with a working example for both the lcd, and ir... then copy the required libraries from one to the other, and add a chunk of code bit by bit until it stops working... at that point you can see whats causing your problems.

Timofte Andrei (author)  spiffomatic644 years ago
here you can find the code https://www.dropbox.com/s/5dt75tzd0xnpix6/lcd%20menu%20%2B%20ir%20remote.txt i'm not sure about the #defines at the beginning of the sketch... i'm using ken's ir library and it's working...i can receive codes from IR remote control but i want to use those codes to control the menu...i just need an idea how to alter the original sketch from that site mentioned in the main post, to use the codes from IR remote as some physical buttons connected directly to digital pins of Arduino...
ok it looks like you need to swap our your button read code, with conditional's based on the IR codes you recieve.

so something like

void navigateMenus() {
MenuItem currentMenu=menu.getCurrent();

switch (results){
case irEnter:
if(!(currentMenu.moveDown())){ //if the current menu has a child and has been pressed enter then menu navigate to item below
menu.use();
}else{ //otherwise, if menu has no child and has been pressed enter the current menu is used
menu.moveDown();
}
break;
case irEsc:
menu.toRoot(); //back to main
break;
case irRight:
menu.moveRight();
break;
case irPinLeft:
menu.moveLeft();
break;
}

results=0; //reset the lastButtonPushed variable
}

You wont learn anything if we code this completely for you, so you will need to figure this out a bit.

You'll need to define irX variables I used above instead of the buttonvariables you used.
Timofte Andrei (author)  spiffomatic644 years ago
i know that...I have some project using the IR sensor. Check my instructable about the relay module ;).
ok, then I'd need to see your code to help out more...

the lcd may be using the same interrupts/pins/hardware the ir code you are using does.

typically its as simple as copy/pasting the necessary libraries together and code, and it just works :)
Timofte Andrei (author)  spiffomatic644 years ago
actually there is nothing bad about the code... and about libraries. it's about integration the IR option to the original code. I've altered the original code from that site to work on a PCD8544 display (nokia5110) and it's working well... I've tried something like this:
if (value.results==XXXX)
{
(leftButton,HIGH);
} , but didn't worked...
I think you are going to need to post some code... the code above doesnt make much sense? you are checking value.results against something, then it looks like you are doing a digitalread if this statement is true? I have no idea what you are doing here.

If your project isnt working, the code obviously IS bad. im not trying to be a jerk or anything... but its tough to help without seeing the code.

what pin are you trying to read from for the ir library? (and are you using ken's ir library?)
Timofte Andrei (author)  spiffomatic644 years ago
here you can find the code https://www.dropbox.com/s/5dt75tzd0xnpix6/lcd%20menu%20%2B%20ir%20remote.txt i'm not sure about the #defines at the beginning of the sketch... i'm using ken's ir library and it's working...i can receive codes from IR remote control but i want to use those codes to control the menu...i just need an idea how to alter the original sketch from that site mentioned in the main post, to use the codes from IR remote as some physical buttons connected directly to digital pins of Arduino...