Help required- Changine Time and date using 4-buttons and LCD

Hi all,
I am currently working on Solar Tracker for Solar Panel. The mathematical model/formulas with the help of this forum is working great. My System includes three Menus:
1- DISPLAY PARAMETERS (Where curret time/Date, Azimuth, Elevation, Sunset, SunRise, Backlash, Motor Speed, Latitude ,Longitude, Updation time, Azimuth/Elevation Stepper steps, Azimuth / Elevation Steppers Gear Ratios etc will be displayed)
2- CONFIGURAION ( Here The User change the settings and these settings will be then stored in EEPROM. Mostly all the Display Parameters can be set by the User)

I need help in getting idea of How the TIME and DATE can be set?
FOR EXAMPLE:

10 : 42 :18
I want to change the time. using 4 buttons UP DOWN RIGHT and LEFT.
10 : 42 :18
^
Initially the Cursor is at “1” of the 10 as shown above.The "UP button when pressed can change it fro “0” to “2”…Once set, i will press the Right button, the cursor moves to “0” of the 10 as shown below:
10 : 42 :18
^
Then when i press the UP button the value to be change is from “0” to “3”. Then when i press the Right Button i get to “42” and the cursor is on “4”… I need help is it possible? any pseudo code or help is highly appreciated.

Hi

You could use m2tklib.
Discussion is here: Arduino Forum
Project page: Google Code Archive - Long-term storage for Google Code Project Hosting.

A time entry could be implemented like this:

uint32_t time_h, time_m, time_s;
M2_U32NUM(el_h, "c2a1", &time_h);
M2_TEXT(el_l1, "r1", ":", 1);
M2_U32NUM(el_m, "c2a1", &time_m);
M2_TEXT(el_l2, "r1", ":", 1);
M2_U32NUM(el_s, "c2a1", &time_s);
M2_LABEL(el_l3, NULL, " ");
M2_LIST(list_time) = { &el_h, &el_l1, &el_m, &el_l2, &el_s, &el_l3, &el_goto_top };
M2_HLIST(el_timelist_top, NULL, list_time);

This would match your specification of you also use the 4-Button event handler 4bs
(Google Code Archive - Long-term storage for Google Code Project Hosting.).

Oliver

Thanks Oliver but not that i want.. I have total 06 buttons keypads ..Apart from UP/DOWN RIGHT/LEFT I have SET and ESC keys.. I am using menubackend.h successfully. All i want a simple program to set the time and date as described above. Any help is appreciated from esteemed forum members.

Hi

Ok, it was not clear for me that this was a specific request for a solution together with menubackend.
Indeed I did not know menubackend at all. Is it still active and supported? Maybe it should be listed on the playground in the "user interface" section.

I have total 06 buttons keypads

There is also a six-button handler in m2tklib. And, of course, menus are also supported by m2tklib.

The primary goal of m2tklib is to design dialog boxes to let the user enter any kind of data with two- to six- button hardware. Letting the user enter time, as requested by you, is one of m2tklibs primary goals :smiley:
The dialog box for time entry needs nothing more than the code from my previous post. Well, at least i thought that it is simple :roll_eyes:

Greetings, Oliver

Dear Oliver,
Thank you for answering me and pointing to the solution. Actually i am handling a big menu with the help of menubackend.h flawlessly. user has to be prompt for entering Time/Date Latitude/Longitude, Stepper Gear Ratios and Other informations. So only Time and Date is not needed alone. I will check the library you have mentioned and will see that whether it can work with 20x4 LCD display???...
Meanwhile I am thinking of using of infinite for(;:wink: loop in which will be break; only when either ESC or SET button is pressed. In either case a Confirmation dialogue will appear on LCD to get the Approval of enetered Value to put in EEPROM or to Discard the values entered.

I know many peoples here are not answering as i have not submitted the code.. I will try to make it in the form to be submittable and understandable.

Regards