Pages: 1 ... 28 29 [30] 31 32   Go Down
Author Topic: MENWIZ: yet another character lcd menu wizard library  (Read 58926 times)
0 Members and 1 Guest are viewing this topic.
Poland
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone ! smiley

First of all, I'd like to thank brunialti for creating such a brilliant piece of usefull code and other users for help and their inputs to this thread.

I just have a quick question - somewhere in my menu, I'll have 3 options to choose. They will trigger program "modes" . That is simple. But is it possible to have another button as a shortcut to one of those options ? ( If pressed, program will "go" to mode represented by this menu option whitch this button is pointing to ). Button can be pressed anytime - on "userscreen' , in menu etc.  If yes, would anyone point me a direction to follow with some egzaple code or "pseudocode" ? Thanks in advance ! smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

you can put something like that in the loop directly:
Code:
void loop(){
  menu.draw();
  if (digitalRead(LEFT_BUTTON_PIN)==LOW){
    Serial.println("Doing Stuff");
    DoSomething();
  }
}

In this case, it runs the function DoSomething() upon a press of the left button. You can also check for the individual buttons in your functions.
Logged

Poland
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for quick reply smiley But I think it's not what I'm looking for. I'm looking for a way to use one button as a shortcut to one "option" in menu. In other words - one can use menu and choose some options which then will control a program ( loop ). But someone could press just one button related to one option in the menu. And menu " will know" that this button was pressed and it will change it's options.

Using button to change program is simple. But how can I " let menu know", that button was pressed so it can change and next time I use menu, I'll see the option was changed?

I wish I could explain it a bit better but English is not my native lingo smiley-wink
Logged

rome
Offline Offline
Sr. Member
****
Karma: 15
Posts: 474
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Inside the class _menu there is the variable cur_menu of type _menu* pointing to the current menu object.
so the code should look like the following (never tested)

Code:
_menu *my_entry;
...
void setup(){
...
    my_entry=menu.addMenu(MW_SUBMENU,r,F("MEASURE SUBMENU"));     //add a child (submenu) node to the root menu
...
}

void loop(){
  menu.draw();
  if (digitalRead(MY_SHORTCUT_BUTTON)==LOW){
    menu.cur_menu=my_entry; // the my_entry submenu will be shower in the next draw call
  }
}

« Last Edit: September 17, 2013, 04:41:35 pm by brunialti » Logged

Poland
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank You for quick answer.  I have tried meny menu libriaries but i choose this one mostly because of support from it's creator smiley 
I will try this code this evening but i have a feeling that this is what i was looking for. 
Just quick one -  is it possible to change those custom charakteru pointing current position in the menu on LCD? 
Logged

rome
Offline Offline
Sr. Member
****
Karma: 15
Posts: 474
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at MENWIZ.cpp and find the following code lines:

Code:
const uint8_t c0[8]={B00000, B00000, B00001, B00010, B10100, B01000, B00000, B00000};

const uint8_t c1[8]={B00000, B11100, B00100, B00100, B10101, B01110, B00100, B00000};

const uint8_t c2[8]={B00000, B01010, B11111, B01110, B11111, B01010, B00000, B00000};

They are the character bitmap definitions. You can change them if you like


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Brunialti, I have seen your piece of SW and I found it very interesting.
Unfortunately to save time in wiring and soldering I bought the LCD shield
were buttons are arranged as a voltage divider and send a value to the A0
pin of Arduino. This save the pins count and work quite well.
In SW a grid of IF translate the voltage value in a number inside a int variable.
It' s possible to add the tree.navButtons2 command ? Something like this:
tree.navButtons2(variable_name,UP_BOTTON_#,DOWN_BOTTON_#,LEFT_BOTTON_#,RIGHT_BOTTON_#,ESCAPE_BOTTON_#,
     CONFIRM_BOTTON_#);
This to use your excellent work in a widely sold LCD shield.
I live in Rome too. we can discuss this topic sitting in front of two beers.
TNKs
 
Logged

rome
Offline Offline
Sr. Member
****
Karma: 15
Posts: 474
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok for the beers as soon I'll be back in Rome.
In the meantime, you can solve your problem using the addUsrNav method (look at the "How to use custom input devices instead of standard digital buttons " chapter in the manual) that is a more general approach to "custom" device usage.
« Last Edit: September 18, 2013, 09:17:32 am by brunialti » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am a 100% beginner and have the following problem trying to run the sketch:

Code:
In file included from quick_tour.ino:6:
/Users/ton/Documents/Arduino/libraries/Menwiz/MENWIZ.h:230: error: ISO C++ forbids declaration of 'LCD' with no type
/Users/ton/Documents/Arduino/libraries/Menwiz/MENWIZ.h:230: error: expected ';' before '*' token

I could not find any solution anywhere... Please someone help.

btw: this happens with the 'official' version as well as with the beta 1.3 version, must be me doing something wrong.
OSX btw
Logged

rome
Offline Offline
Sr. Member
****
Karma: 15
Posts: 474
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The first error is a library problem: the ide does not correctly "sees" the new liquidCrystal library (btw: did you replaced the stock one with the provided one?) as LCD is an include file defineng the abstarct data type LCD
The second seems to be a code error, that should'nt occour as the library is currently used by many users.
delete the ide, reinstall the latest version, replace the stock ib liquidCrystal with the liquidCrystal inside the MENWIZ packege, install the Button library provided, try to use the lcd without MENWIZ, and finally use MENWIZ.

« Last Edit: September 23, 2013, 01:06:02 am by brunialti » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The first error is a library problem: the ide does not correctly "sees" the new liquidCrystal library (btw: did you replaced the stock one with the provided one?) as LCD is an include file defineng the abstarct data type LCD
The second seems to be a code error, that should'nt occour as the library is currently used by many users.
delete the ide, reinstall the latest version, replace the stock ib liquidCrystal with the liquidCrystal inside the MENWIZ packege, install the Button library provided, try to use the lcd without MENWIZ, and finally use MENWIZ.



thank you, those are very clear instructions. I will try them this afternoon.

Thank you once again and thank you for your great software.
Logged

Poland
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello again!  I've got everything working so far - thanks for your assistance smiley  Just have another question -  is it possible to use external (I2C) EEPROM for storing all the values using this library?  I know how to do it "outside" this library but would be great to have it in one place.
Logged

rome
Offline Offline
Sr. Member
****
Karma: 15
Posts: 474
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In MENWIZ are already provided the methods (writeEeprom and readEeprom) to save/load all the (user) variables associated to the menus to internal EEPROM....
Logged

Poland
Offline Offline
Jr. Member
**
Karma: 1
Posts: 85
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know smiley And this is working good. But what if one would like to store them in external EEPROM - using I2C chips.
« Last Edit: September 24, 2013, 11:03:10 am by waski » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know smiley And this is working good. But what if one would like to store them in external EEPROM - using I2C chips.

I think that what he meant to say is that you can fix it yourself, just change the calls from the internal to the external eeprom.
Logged

Pages: 1 ... 28 29 [30] 31 32   Go Up
Jump to: