Just like a drug addict, I say ‘This will be my last menu I create from scratch’, and yet, a week or so passes and I create another. And another. Well it’s a good thing that I have this addiction, because each menu system turns out to be better than the last.
It just so happens that this menu system that I’ve created, is the best currently, and that can ever be. Yep, it’s true.
I’ve just attached them via pastebin, since the syntax highlighting is so nice, I’ve created an account and will put my code there on a temporary basis. If there is a bigger project, then it can go into its own sourceforge project account. Ultimately, it is your responsibility to save this, since I cannot guarantee that wordpress or pastebin will always be around. If you like it, take it 🙂 The compiled size is 3516 bytes, which is pretty decent in my view(and that is including the ShiftRegLCD LCD functions).
Next up, adding things to it. I think I’ll go ahead and add all of the BT and XBee configuration code, then I’ll start playing with the NunChucks! Can’t wait to start playing with solar panels…
This is the main code, which includes the entire menu system: http://pastebin.com/3KXvST5V
Here is a simple file that has three simple functions to handle multiple buttons on a ADC channel: http://pastebin.com/Ddj8pcbm
Raw paste of code is below (not pretty :P)
Yes, I spilled my coffee on my notebook It has mostly dried, so I think it will be okay, but my notebook is a very important tool, since it not only helps me brainstorm, but it helps me document things.
When I was trying to design this new menu system, I thought of many kinds of complicated things. After struggling for over an hour to get a concept I had to work, I took a break. Instead of trying to answer the question “How do I make a menu system that does all of these things”, I thought of this question: “How do I make a very simple menu system?”
It won’t be as simple as the code bits from the last post suggested, but I do believe it will be easier to work with. All of the menu things are in the main .ino file, and the only thing that is in the “Library” are the functions to handle the buttons (from an ADC channel, to button pressed).
I’ll go ahead and post what I have now here, although later I will make a repository for it. And it’s not even done, I still have some work to do on it, but I think it is a step in the right direction, towards simplicity. I’ll be using this menu system to organize functions that I’ll use for the wireless testing. I’ll also do SD card management on it as well (maybe reading from the SD card and showing it on the LCD :P)
An important note: Throughout my development on this, I use version control (Mercurial) so that once I got to a good space, I could quickly make a commit, and have a place where I can go back to, which I had to on several occasions. Commiting is so easy, that you’ll want to do it often (as you should).