RGB LCD Shield #772 menu question

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
99Valkyrie
 
Posts: 8
Joined: Sun Jan 13, 2013 5:48 pm

RGB LCD Shield #772 menu question

Post by 99Valkyrie »

Hello,

I recently purchased the Adafruit shield (Blue/White monochrome) noted in the subject above. Got it all put together and it displays the Hello world sketch just fine. I can change the buttons so they act/report differently (only slightly modifying the existing code. I purchased this particular kit because it only uses the two pins which leaves me many more for other things.

My question is this. Is there a tutorial or example of a simple menu system? By this I mean, my Uno would start with a "splash" screen then present the top level choice, let's say "TEST 1" first with one or two more choices below accessed by hitting the down button. If TEST 1 is chosen 2 "children" would be available, RUN and STOP. I envision pressing the LEFT button would exit back to the top level. Secondary levels (below TEST 1) could be reached by pressing the down buttons to continue through the menu system choosing different items/functions.

Like I said, just looking for either a few tutorials or some examples so that I can learn to use this shield effectively.

I would appreciate any advice and/or suggestions. Thanks.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_rick »

The main loop of the 'Hello world" example code is an example of a menu system. What it does is to continually read the button status, and it modifies the display according to which buttons are pressed. One thing that's a little different about it, though, is that it allows multiple buttons to be pressed at once. For a regular menu system, you would probably want to use a switch statement, instead of a series of if statements, like so:

Code: Select all

 uint8_t buttons = lcd.readButtons();
 switch (buttons) {
	 case (BUTTON_DOWN):
		<scroll menu down one selection>
		break;
	 case (BUTTON_UP):
		<scroll menu up one selection>
		break;
	 case (BUTTON_LEFT):
		<move menu up one level>
		break;
	 case (BUTTON_RIGHT):
		<move menu down one level>
		break;
	 case (BUTTON_SELECT):
		<execute the currently displayed menu item>
		break;
	 default:
		break;
 }
So, it's up to you to design the menu. Things to do when you move up, down, right or left are to figure out what menu state you're moving to, display the new menu text, and keep track of where you are in the menu. On a select, you're going to call some function to preform the desired action.

99Valkyrie
 
Posts: 8
Joined: Sun Jan 13, 2013 5:48 pm

Re: RGB LCD Shield #772 menu question

Post by 99Valkyrie »

Thank you for your time, explanation and an example. I'm still rather new at this so I did not "see" a menu in the "Hello world" example. I'm going to go back, take another loo0k at it and try to grasp what is going on in that code.

In your example of the switch statement, I'll need to do some more reading to try to understand how that functions. At face value it seems relatively easy but I need to gain more understanding. I prefer to "see" what is happening in the coding of these neat machines.

Again, many thanks.

alpha2
 
Posts: 3
Joined: Thu Jan 31, 2013 6:32 pm

Re: RGB LCD Shield #772 menu question

Post by alpha2 »

I'm a total nube to Arduino and I purchased an Arduino Mega 2560 R3 and Adafruit shield with a 2x16 blue and white display.

Where can I find the "Hello world" to get started?

Thanks in advance

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_rick »

The example code is included with the library download. See this page of our Tutorial.

If you've already downloaded and installed the library, open the File menu in the Arduino IDE, and select Examples. In the popup, select Adafruit_RGBLCD, and then select HelloWorld.

alpha2
 
Posts: 3
Joined: Thu Jan 31, 2013 6:32 pm

Re: RGB LCD Shield #772 menu question

Post by alpha2 »

Thanks for the link and info.
I've read through the FAQs for the location of the library and I'm wondering if there's a compatibility issue with Arduino side version 1.0.3. The instructions say to place the library in the sketch folder via the "Show Sketch Folder" function. I can create the folder and copy the files to the new location but they don't seem to be saved or at least not visible if I look for them after closing and restarting the IDE.
Where am I going wrong here?

alpha2
 
Posts: 3
Joined: Thu Jan 31, 2013 6:32 pm

Re: RGB LCD Shield #772 menu question

Post by alpha2 »

Please disregard the previous post.
I re-installed the libraries in the correct location and the display is now working properly.

Thanks for your help and patience.
Maybe now I can start moving forward.

Jim

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_rick »

Did you rename the library folder you downloaded?
To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_RGBLCDShield. Check that the Adafruit_RGBLCDShield folder contains Adafruit_RGBLCDShield.cpp and Adafruit_RGBLCDShield.h
I'm not sure where you saw the instruction to place the library in the sketch folder via the "Show Sketch Folder" function? That isn't going to show you the right place.
The library folder should go into the /libraries folder inside the sketchbook folder. Open the preferences window of the IDE (File:Preferences in Windows, Arduino:Preferences on MacOSX). You'll see the path to the 'Sketchbook location'.

Don't change the path. Close the IDE and go to the sketchbook folder. There should already be a folder in there called 'libraries'. Your LCD library folder goes inside of there.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_rick »

alpha2 wrote: I re-installed the libraries in the correct location and the display is now working properly.
Great!

del618
 
Posts: 5
Joined: Thu Jun 27, 2013 7:27 pm

Re: RGB LCD Shield #772 programming question

Post by del618 »

I downloaded the Adafruit_RGBLShield and renamed it as described. When I try to compile the program it gives me the following line; "Adafruit_RGBLShield::Adafruit_RGBLShield(){
Adafruit_RGBLShield has not been declared.
How do I overcome this error? It is very frustrating for me to download something that does not work correctly.

Thanks D.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_bill »

Did you install it as described here? : http://learn.adafruit.com/adafruit-all- ... nstall-use

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_rick »

del618 wrote:"Adafruit_RGBLShield::Adafruit_RGBLShield(){
Adafruit_RGBLShield has not been declared.
The library should be named "Adafruit_RGBLCDShield", not "Adafruit_RGBLShield"

del618
 
Posts: 5
Joined: Thu Jun 27, 2013 7:27 pm

Re: RGB LCD Shield #772 menu question

Post by del618 »

I reloaded it and it Works now.

Thanks

del618

cekuz
 
Posts: 6
Joined: Sat Nov 09, 2013 5:57 pm

Re: RGB LCD Shield #772 menu question

Post by cekuz »

adafruit_support_rick wrote:The main loop of the 'Hello world" example code is an example of a menu system. What it does is to continually read the button status, and it modifies the display according to which buttons are pressed. One thing that's a little different about it, though, is that it allows multiple buttons to be pressed at once. For a regular menu system, you would probably want to use a switch statement, instead of a series of if statements, like so:

Code: Select all

 uint8_t buttons = lcd.readButtons();
 switch (buttons) {
	 case (BUTTON_DOWN):
		<scroll menu down one selection>
		break;
	 case (BUTTON_UP):
		<scroll menu up one selection>
		break;
	 case (BUTTON_LEFT):
		<move menu up one level>
		break;
	 case (BUTTON_RIGHT):
		<move menu down one level>
		break;
	 case (BUTTON_SELECT):
		<execute the currently displayed menu item>
		break;
	 default:
		break;
 }
So, it's up to you to design the menu. Things to do when you move up, down, right or left are to figure out what menu state you're moving to, display the new menu text, and keep track of where you are in the menu. On a select, you're going to call some function to preform the desired action.
Hi all! I'm new and I need some help with the code to manage a menu and execute commands for a time lapse dolly.
Where does the code you suggest should be written? In the void setup? And moreover, how can I add the command line (i.e. "motor go forward") and manage input variables using the LCD shield such us direction, speed and delay of execution?

Thank you very much

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: RGB LCD Shield #772 menu question

Post by adafruit_support_bill »

Where does the code you suggest should be written? In the void setup?
No. setup() only gets executed once on startup. If you need to process many commands, you should do it in the loop() function which gets executed over and over again.
how can I add the command line (i.e. "motor go forward") and manage input variables using the LCD shield such us direction, speed and delay of execution?
This tutorial might be a better example to look at. It uses the LCD shield to enter control parameters: http://learn.adafruit.com/sous-vide-pow ... o/software

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”