Hi,
I don't get the code below working (except with the wrapper function). I do not want to use the wrapper function because it kills the function callback idea. How can I write the code without writing the wrapper function? Hope you can help me, thx.
This is the code that gives the error:
#include <TimedAction.h>
#include <Time.h>
#include <TimeAlarms.h>
const unsigned long timeout10Sec = 10000; //10 sec.
TimedAction boilerTimeout = TimedAction(timeout10Sec, boilerPowerOff);
void boilerPowerOff(){
//power off te boiler.
}
void setup(){
setTime(8,29,0,1,1,10); // set time to 8:29:00am Jan 1 2010
// create the alarms
Alarm.alarmRepeat(8,30,0, boilerTimeout.reset);
}
void loop(){
boilerTimeout.check();
}
I receive this error message:
error_example.cpp: In function 'void setup()':
error_example:19: error: no matching function for call to 'TimeAlarmsClass::alarmRepeat(int, int, int, <unresolved overloaded function type>)'
C:\Users\athome\Dropbox\Home automation\Arduino\arduino-0022\libraries\TimeAlarms/TimeAlarms.h:69: note: candidates are: AlarmID_t TimeAlarmsClass::alarmRepeat(time_t, void (*)())
C:\Users\athome\Dropbox\Home automation\Arduino\arduino-0022\libraries\TimeAlarms/TimeAlarms.h:70: note: AlarmID_t TimeAlarmsClass::alarmRepeat(int, int, int, void (*)())
C:\Users\athome\Dropbox\Home automation\Arduino\arduino-0022\libraries\TimeAlarms/TimeAlarms.h:71: note: AlarmID_t TimeAlarmsClass::alarmRepeat(timeDayOfWeek_t, int, int, int, void (*)())
This is the code with the wrapper function which works fine:
#include <TimedAction.h>
#include <Time.h>
#include <TimeAlarms.h>
const unsigned long timeout10Sec = 10000; //10 sec.
TimedAction boilerTimeout = TimedAction(timeout10Sec, boilerPowerOff);
void boilerPowerOff(){
//power off te boiler.
}
void wrapper(){
boilerTimeout.reset();
}
void setup(){
setTime(8,29,0,1,1,10); // set time to 8:29:00am Jan 1 2010
// create the alarms
Alarm.alarmRepeat(8,30,0, wrapper);
}
void loop(){
boilerTimeout.check();
}