Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: TimeAlarms Library: how to disable or kill created Alarm or Timer?

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    12

    TimeAlarms Library: how to disable or kill created Alarm or Timer?

    I'm use a Alarm.alarmRepeat(hours, minutes, seconds, function) function in my alarm clock - create an alarm that will call a function every day at a particular time.

    How to disable/kill/pause this Alarm?

  2. #2
    Junior Member
    Join Date
    Mar 2014
    Posts
    12
    Hello again
    I'm found answers in readme.txt file (strange that this is not mentioned on the web page):
    Low level functions not usually required for typical applications:
    disable( ID); - prevent the alarm associated with the given ID from triggering
    enable(ID); - enable the alarm
    write(ID, value); - write the value (and enable) the alarm for the given ID
    read(ID); - return the value for the given ID
    readType(ID); - return the alarm type for the given alarm ID
    getTriggeredAlarmId(); - returns the currently triggered alarm id, only valid in an alarm callback
    but please explain how types (byte, int, boolean, etc.) of these functions and some code samples - how use these functions. I can't found samples.

  3. #3
    Senior Member
    Join Date
    Jan 2013
    Location
    Dallas, TX USA
    Posts
    111
    Simply look at the header file it is all spelled out.

    Code:
     AlarmID_t triggerOnce(time_t value, OnTick_t onTickHandler);   // trigger once at the given time_t
    
      AlarmID_t alarmRepeat(time_t value, OnTick_t onTickHandler);                    // trigger daily at given time of day
      AlarmID_t alarmRepeat(const int H,  const int M,  const int S, OnTick_t onTickHandler); // as above, with hms arguments
      AlarmID_t alarmRepeat(const timeDayOfWeek_t DOW, const int H,  const int M,  const int S, OnTick_t onTickHandler); // as above, with day of week 
     
      AlarmID_t alarmOnce(time_t value, OnTick_t onTickHandler);                     // trigger once at given time of day
      AlarmID_t alarmOnce( const int H,  const int M,  const int S, OnTick_t onTickHandler);  // as above, with hms arguments
      AlarmID_t alarmOnce(const timeDayOfWeek_t DOW, const int H,  const int M,  const int S, OnTick_t onTickHandler); // as above, with day of week 
      
      AlarmID_t timerOnce(time_t value, OnTick_t onTickHandler);   // trigger once after the given number of seconds 
      AlarmID_t timerOnce(const int H,  const int M,  const int S, OnTick_t onTickHandler);   // As above with HMS arguments
      
      AlarmID_t timerRepeat(time_t value, OnTick_t onTickHandler); // trigger after the given number of seconds continuously
      AlarmID_t timerRepeat(const int H,  const int M,  const int S, OnTick_t onTickHandler);   // As above with HMS arguments

    All the functions return a AlarmID_t or AlarmID.
    You save the ID from the call in your AlarmID variable that you declare,
    then use it in the other functions like enable()/disable()

    --- bill

  4. #4
    Junior Member
    Join Date
    Mar 2014
    Posts
    12
    grand thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •