RGB LCD Shield #772 menu question

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

Moderators: adafruit_support_bill, adafruit

RGB LCD Shield #772 menu question

Postby 99Valkyrie » Sun Jan 13, 2013 5:04 pm

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.
99Valkyrie
 
Posts: 2
Joined: Sun Jan 13, 2013 4:48 pm

Re: RGB LCD Shield #772 menu question

Postby adafruit_support_rick » Sun Jan 13, 2013 6:36 pm

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.
User avatar
adafruit_support_rick
 
Posts: 2906
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield #772 menu question

Postby 99Valkyrie » Mon Jan 14, 2013 5:43 am

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.
99Valkyrie
 
Posts: 2
Joined: Sun Jan 13, 2013 4:48 pm

Re: RGB LCD Shield #772 menu question

Postby alpha2 » Sat Feb 02, 2013 8:51 pm

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
alpha2
 
Posts: 3
Joined: Thu Jan 31, 2013 5:32 pm

Re: RGB LCD Shield #772 menu question

Postby adafruit_support_rick » Sun Feb 03, 2013 10:22 am

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.
User avatar
adafruit_support_rick
 
Posts: 2906
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield #772 menu question

Postby alpha2 » Mon Feb 04, 2013 5:53 pm

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 5:32 pm

Re: RGB LCD Shield #772 menu question

Postby alpha2 » Mon Feb 04, 2013 6:38 pm

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
alpha2
 
Posts: 3
Joined: Thu Jan 31, 2013 5:32 pm

Re: RGB LCD Shield #772 menu question

Postby adafruit_support_rick » Mon Feb 04, 2013 6:49 pm

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: 2906
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: RGB LCD Shield #772 menu question

Postby adafruit_support_rick » Mon Feb 04, 2013 6:50 pm

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


Great!
User avatar
adafruit_support_rick
 
Posts: 2906
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY


Return to Other Arduino products from Adafruit

Who is online

Users browsing this forum: mibignistinly and 9 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]