Support with the TimeAlarm library please

Hi All,

re the TimeAlarm.h library file:

Would someone be so kinds to assist me by explaining how this expression should be populated and what each part is referencing please? i'm having trouble getting to work in a function. An example of one populated would really help.

AlarmID_t create( time_t value, OnTick_t onTickHandler, uint8_t isOneShot, dtAlarmPeriod_t alarmType, uint8_t isEnabled=true);

Thanks :)

As a guess Alarm.Create (20,Blinkerloop,Repeat,true ); doesn't work just a guess.

As a guess Alarm.Create (20,Blinkerloop,Repeat,true ); doesn’t work just a guess.

The first argument is the time and date that the alarm should go off. How should the function handle 20 as a time and date?

The names are not all that helpful, but the types give clues.

The function to call is the second argument, which is fairly obvious.

The 3rd argument is the type of alarm - one time only or repeating.

The 4th argument is the interval between repeats. true will have the alarm going off every 1 somethings (whatever the interval type is - millisecond, second, minute, hour…).

The 5th (optional) argument lets you create an alarm that is not enabled, so that you can, if something happens, for instance, enable it later.

Thanks Paul,

Still an issue please see the below Test code line 42 won’t compile due to the create function. I have tried various configurations for a while now without success. could that line be altered such that it will compile please?

Also although the example shows an ALARM being created (with time) I need an Alarm.timerRepeat “count down timer” therefore no time and date is required; any comments how I would go about configuring that… :confused:

Thanks in avance

#include <Time.h>
#include <TimeAlarms.h>
const int buttonPin = 2; 
const int LED7 = 7;
int buttonState = 0;
int BuzzerFLAG = 0;

AlarmID_t timerBliker;

void setup()
{
  pinMode(LED7, OUTPUT);
  pinMode(buttonPin, INPUT);
 
  Serial.begin(9600);
  setTime(8,29,0,1,1,11); // set time to Saturday 8:29:00am Jan 1 2011

 timerBliker = Alarm.timerRepeat(6, alarmDoorOpenBlinker);            // timer for every 15 seconds 
   Serial.print("timerBliker: ");
  Serial.println(timerBliker);
}
  void loop(){ 
  buttonState = digitalRead(buttonPin);
  Alarm.delay(1000); // wait one second between clock display
  if (buttonState = 0){
    
  Serial.println("*******ALARMS DISABLED****************"); 
    Alarm.disable(timerBliker);
     Alarm.delay(100);
  AlarmID_t ID = Alarm. getTriggeredAlarmId();
  Serial.print(ID);
  Serial.println("...ID Bliker Disabled"); }
  else if  (buttonState = 1){
    Alarm.enable(timerBliker);
  }

  }


    void alarmDoorOpenBlinker(){
   AlarmID_t ID = Alarm. getTriggeredAlarmId();
   Alarm.create(8,32,0,test,timerOnce, 30,true);
    Alarm.delay(100);
  Serial.print(ID);
  Serial.println("...ID Bliker Alarm Activated");
   Alarm.delay(100);
  digitalWrite(LED7, HIGH);   // turn the LED on (HIGH is the voltage level)
  Alarm.delay (500);
   digitalWrite(LED7, LOW);   // turn the LED on (HIGH is the voltage level)
   Alarm.delay (500);
    digitalWrite(LED7, HIGH);   // turn the LED on (HIGH is the voltage level)
}
  void test(){
  Serial.print("TEST Alarm.create");
}

Here is the excerpt from the above code Alarm.create(8,32,0,test,timerOnce, 30,true); anyone able to correct this so the code compiles?

Still an issue please see the below Test code line 42 won't compile due to the create function.

What is the error? Have you looked at the examples that come with the library? I know for a fact that there is an example if the Alarm.create() method being used.

I need an Alarm.timerRepeat "count down timer" therefore no time and date is required

Really? When do you want the repeat pattern to begin? I don't know if anyone has ever pointed this out to you, or not, but time does not run backwards.