Go Down

Topic: Adafruit 20x4 LCD - Creating a menu (Read 68 times) previous topic - next topic

aumanu

Hi,

I am relatively new to Arduino and I am currently working on a project that consists of an Aruduino Mega, 3 buttons (Left, Right and Confirm), Adafruit 20x4 RGB LCD and Adafruit LEDs.

What I want to achieve is to be able to have a menu on the LCD screen - consisting of a main menu, with two options, a secondary menu, with 13 options, and finally an action to occur (LED's light up) when an option in the second menu is selected.

So far I have a number of codes to illuminate the LEDs in order, which is working fine, and I have been able to print to the LCD screen, however I am unsure how to create a menu that recognises which menu/submenu had been pressed to correspond to the right action.

If anyone could help it would be much appreciated.

Attached are the codes I am currently using for the LCD and for the Adafruit Neopixel LED's

Thanks
L


CarlW

You should combine your two sketches into one.

In the programming forum, there is a sticky thread near the top of page 1 with a GREAT methodology for writing a sketch. It's an easy read and I think it would help you out.

I looked at your code and it looks like you are going in the right direction! There might be better ways to debounce your buttons than the delay statement. One way is to add a small capacitor to the button. Another way is to toggle a global variable and only look for the confirm button at the appropriate time. Or to only update the screen when something changes instead of every cycle. Etc.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy