Go Down

Topic: Menu for Display (Read 17 times) previous topic - next topic


Hi Oliver,
after one day that work on that ... I can say this:

- RTC and Arduino Clock are correctly set
- Without use a timer but only put a standard clock for example clock that change in working
- With timer for sure the timer are correct but stop to work ...

it's possible that timer is not compatible with menu or viceversa ?

Thanks for the support,




Excause me for not reading this thread more often.

I do not know much about the timer itself. What i can say: M2tklib will use
- digitalRead
- Serial interface for the Monitor Simulation
Can this do any harm to your system?

What you could do is to comment out
Code: [Select]
  if ( m2.handleKey() )

and check if things are working again.
Maybe you can also check the timer procedures with some small menu.
If this is working, that it is probably a memory issue.
Which Arduino do you use?



No problem Oliver don't worry :-) thanks for your help and time :-) I was writing you because during this day I was free time for do the try just it :-) ...

So due the fact I've note this ... for example without set a timer retriving date and time from RTC it's working ...

Code: [Select]

void loop() {
    // Alarm.triggerOnce(makeTime(tm0start), StartTimer0);
     // Alarm.triggerOnce(makeTime(tm0stop), StopTimer0);
  Serial.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
  Serial.print(RTC.get(DS1307_MIN,false));//read minutes without update (false)
  Serial.print(RTC.get(DS1307_SEC,false));//read seconds
  Serial.print("      ");                 // some space for a more happy life
  Serial.print(RTC.get(DS1307_DATE,false));//read date
  Serial.print(RTC.get(DS1307_MTH,false));//read month
  Serial.print(RTC.get(DS1307_YR,false)); //read year
  if ( m2.handleKey() )

Then what i mean it that execute the instruction into the loop also ...

I think that is necessary troubleshoot Time.h library , but i don't know if i will be able to this ...
the library menu use some particular resources sorry if I ask you but could be useful tomorrow when i'll try to compare the 2 library ....

so I'm using arduino 2560 mega ...

Thanks for the big support,
have a good night ...


Jan 25, 2013, 07:26 am Last Edit: Jan 25, 2013, 07:44 am by gnusso Reason: 1
Good Morning Oliver,
so, finally it's working :-) ... after a lots of try I've understand what was really missing ...

Code: [Select]


Looking the code you will note that like Year I've explict "13" --> "2013" before there was this :

Code: [Select]


That I think means that doesn't accept the calcution in this way in fact is necessary put (), but I will do other try just to understand ... Maybe I will calculate into a variable and then I will pass the value to the function ...

The other problems was that, into the loop is necessary put

Code: [Select]


Otherwise the timer will not start ...

Ok with the timer of course but i think is correct there is a little bit delay because off course in background there is the timer that is working ...

So now i will study an efficient manner how to manage the timer ... I'll let you know because I think that you are a very good teacher... I've to found the way for do a input menu for a timer ... :-) maybe you can help me with this :-)

my idea is do a menu for a timer structure in this way:

  - set timer
     --> select dev
     --> enable / disable
     --> put time start date time
     --> put time stop date time
     (could be the best do start / stop time with only row if is possible)   
   - View Timer Set

so for select a dev and enable/disable i think is not a problem ... for the other could be a issues ...
because im not able to manage at the top the menu :-(


Thanks and have nice day,



Maybe i have not yet fully understood your problem. Do you want to program exactly one timer or more than one timer?

In either case, you need to know, what exactly needs to be entered for one timer.
You mention date and time, start and dev.
But it probably needs to be cut down to atomic data times like byte and words.
So this is probably the first step: To break down the required information to small pieces.
For example in this way:
time: hour (byte, 0..23), minute (byte, 0..59), seconds (0..59)
start: could be represented as a status byte: 0 for timer stopped, 1 for time is running. In that sense the variable should be better called "is_running". By the way it is a good practice to have a naming convention for variables. For example if all boolean variables start with "is_" then they are easily seen in the code. You could also do something like
if ( is_running ) ...
which will be executed if the time "runs"
An open question to me is the mentioned "dev" (select dev). What exactly needs to be selected? How much selectable items are there. Can it be mapped to some integer (byte) variable?

So, again, first step is to break down all this to variables. Then write some nice dialog entries for it.

Once done, the question is: Is there only one timer or are there more timers to handle. Of course the existing dialogs should be reused for each different set of timer configuration variables.

if you need to handle more than one timer, i think it will make sense to study tutorial 8: http://code.google.com/p/m2tklib/wiki/t08. Tutorial 8 has a configuration menu for the PWM output. Compare your timer data with the PWM output in this tutorial. This tutorial also introduces a top level menu. And: The PWM example is also available in the Arduino IDE (if m2tklib is installed correctly)


Go Up