Go Down

Topic: Menu for Arduino Due (Read 448 times) previous topic - next topic

Hydrarian

Hi, I'm making a project that consists in recharging electic vehicles and I need some help about the menu. I try to explain in a better way: I have an LCD Display 16x2 on which I have in the first row a clock+date and in the second row I have 4 things: P1 P2 P3 P4. Each of them is an electrical outlet and above them I have 4 buttons, each of them selects the outlet above and open the relative outlet menu which shows the outlet state (OFF, RC=RECHARGING, MN=MAINTENING). For example:
_______________
|14/07/13 16:42  |                   <- time+date
|P1   P2   P3   P4  |                  <- outlets
---------------------
  o     o    o     o                       <- buttons

I press the first button and i get:
__________________
|14/07/13 16:42    |                   <- time+date
|OFF   P2   P3   P4  |                  <- outlets
-----------------------
  o     o    o     o                         <- buttons

I press the first button again and it change to RECHARGING (blinking). In order to select I have to press the same button for 5 seconds.
If I press the third button it opens the third menu.. ecc ecc
I tried to do the menu with the MenubackEnd library but it hasn't a function to go to a specific menu voice. How can I do this job? Is there a better library that can do this? Or some line code I have to add to my code? Thanks in advance for help.



PaulS

Your choice of terminology leaves a bit to be desired. You can't have an outlet on an LCD. You might have a pictorial representation of an outlet, or you might have a value that relates to an outlet.

Quote
and above them I have 4 buttons

The picture shows the buttons below the "outlets".

Quote
In order to select I have to press the same button for 5 seconds.

Why? Is it because your code uses delay() and simply doesn't get around to checking the switch state often enough? Or, is it that the code is written to require holding the switch for 5 seconds, to prevent accidental changes?

Quote
If I press the third button it opens the third menu.. ecc ecc

No clue what this means. The arrangement of switches and "outlets" in the picture suggests a one-to-one relationship between switches and outlets. Why does the third switch do something different?

Quote
I tried to do the menu with the MenubackEnd library

Seems like a reasonable thing to do. Except for not posting the code, that is.

Quote
but it hasn't a function to go to a specific menu voice.

Voice?

Quote
How can I do this job?

That depends, I would think, on what "this job" is.

Quote
Is there a better library that can do this?

Better than what? Using what criteria to define "better"?

Quote
Or some line code I have to add to my code?

My crystal ball says that you need to add this line of code to the start of loop():
Code: [Select]
Serial.print("I need to post my code");

If that doesn't help, perhaps a clue will have revealed itself.

Hydrarian

Sorry for my bad English, I was in a hurry and I didn't check my post before publishing it...
Yes, the buttons are BELOW the outlet LABELS (P1, P2, P3, P4).
The code is written to require holding the switch for 5 seconds to prevent accidental changes.
Yes, there is a one-to-one relationship between switches and outlet labels, if I press the switch number one I can see (and also select) only the state of the first outlet,if I press the switch number two I can see only the state of the second outlet, if I press the switch number three I can see only the state of the third outlet, if I press the switch number four I can see only the state of the fourth outlet.
I haven't the code here with me now but I will publish it as soon as I can (tomorrow morning). I use that library to create another menu, I didn't code this kind of menu because I didn't find how to make it work, so I have only ideas :).
By menu voice I mean a menu Item. For example in that library if I'm in the menuItem1= P1 and I press the fourth switch, I cannot go to menuItem4=P4, because there isn't a function that allows to jump from an Item to another...
The job is to create this one-to-one relationship between switches and lables and to create a function that allows to switch menu's items even if they are not sequential.
So I was wondering if there is a library that can do this job, or at least that could help me doing it.

Go Up