Return goes back to the last level or quitw the menu
Yeah, but the menus themselves are the crux of the matter. I developed an approach which I ended up publishing as an aritcle for Circuit Cellar "Hierarchical Menus in Embedded Systems" in the Nov 2003 (#160) issue. (Circuit Cellar's business model is to charge for downloads. That far back requires that you download the whole issue.) It is built in C, butit an be implemented in any language.
That project is where I developed the appreciation of making sure the display was working as I mentioned in my response to Max a few reponses below.
Five buttons? Who needs five buttons when one will do?!
The LCD Shield reminds me of a project I worked on 15-20 years ago. It was to be a hurredly-built one-off instrument for another department of our company. It's LCD (from Seetron) had 4 rows of 20 characters and was controlled by a serial port (RS-232). The original specifications for the instrument only required a stop/start function, so I only designed in a single push-button switch (debounced in software), with the measurement results and current function (start vs. stop) of the button displayed on the LCD.
But after most of the hardware had already been built, further discussions with the internal customer indicated a much more sophisticated user interface was required. How to accomplish this without adding more keys, which would require completely rebuilding the front panel and lots of modifications to the circuit board?
The solution was to implement a menu system, with a short keypress highlighting the next menu line on the LCD (and wrapping around from the bottom line to the top line), and a long keypress selecting the menu item, to either perform a function or display a lower-level menu. The 4th line was always a "go back one level" function.
The user waited until after I got this working before letting me know he also needed to be able to enter numeric values! No problem. I created a numeric entry screen displaying the digits 0 to 9, decimal point, plus/minus signs, and if I remember correctly, a left-arrow for backspacing, and "OK" to indicate the entry was complete. Short keypresses cycled through all these symbols and a long keypress selected the symbol. One of the lines displayed the current value being editted.
It actually worked quite well, even if I wouldn't have designed it this way if I had known the complete requirements up front.
Do you know if the software support provided by Adafruit treats the LCD as a write only memory? One of my favourite soapboxes is this issue of not checking to see if the LCD is in fact running. I did a blog on it on MCC- maybe I should recycle it.
One question you may have regards the value of being able to modify the display's background color.
As my code becomes more complex, I may end up checking certain values to make sure they stay within a certain range -- I can see myself using different background colors to alert me as to overall status, like "Red" could indicate something that requires my immediate attention.
January 2016 Cartoon Caption ContestBob's punishment for missing his deadline was to be tied to his chair tantalizingly close to a disconnected cable, with one hand superglued to his desk and another to his chin, while the pages from his wall calendar were slowly torn away.122 comments