1010#include  < TaskManagerIO.h> 
1111#include  < TmLongSchedule.h> 
1212#include  < Wire.h> 
13+ #include  < IoLogging.h> 
1314
1415// 
1516//  Here we create an OO task (a task that is actually a class instance). In this case the exec() method will be
@@ -35,6 +36,7 @@ public:
3536
3637//  Forward references
3738void  dailyScheduleFn ();
39+ void  fiveMinsOnceFn ();
3840
3941// 
4042//  Here we create two schedules to be registered with task manager later. One will fire every days and one will fire
@@ -43,28 +45,29 @@ void dailyScheduleFn();
4345// 
4446TmLongSchedule hourAndHalfSchedule (makeHourSchedule(1 , 30 ), &myTaskExec);
4547TmLongSchedule onceADaySchedule (makeDaySchedule(1 ), dailyScheduleFn);
48+ TmLongSchedule fiveMinsOnceSchedule (makeHourSchedule(0 , 5 ), fiveMinsOnceFn, true);
4649
4750void  setup () {
48-     Serial.begin (115200 );
51+     // Serial.begin(115200);
52+     Serial1.begin (115200 );
4953
50-     Serial. println (" Started long schedule example" 
54+     serdebugF (" Started long schedule example" 
5155
5256    //  First two long schedules are global variables.
5357    //  IMPORTANT NOTE: If you use references to a variable like this THEY MUST BE GLOBAL
5458    taskManager.registerEvent (&hourAndHalfSchedule);
5559    taskManager.registerEvent (&onceADaySchedule);
60+     taskManager.registerEvent (&fiveMinsOnceSchedule);
5661
5762    //  this shows how to create a long schedule event using the new operator, make sure the second parameter is true
5863    //  as this will delete the event when it completes.
5964    taskManager.registerEvent (new  TmLongSchedule (makeHourSchedule (0 , 15 ), [] {
60-         Serial.print (millis ());
61-         Serial.println (" : Fifteen minutes passed" 
65+         serdebugF (" : Fifteen minutes passed" 
6266    }), true );
6367
6468    //  lastly we show the regular event creation method, this task is enabled and disabled by the OO task.
6569    auto  taskId = taskManager.scheduleFixedRate (120 , [] {
66-         Serial.print (millis ());
67-         Serial.println (" : Two minutes" 
70+         serdebugF (" : Two minutes" 
6871    }, TIME_SECONDS);
6972
7073    myTaskExec.setTaskToSuspend (taskId);
@@ -75,6 +78,9 @@ void loop() {
7578}
7679
7780void  dailyScheduleFn () {
78-     Serial.print (millis ());
79-     Serial.println (" : Daily schedule" 
81+     serdebugF (" Daily schedule" 
82+ }
83+ 
84+ void  fiveMinsOnceFn () {
85+     serdebugF (" Five mins once, should not occur again" 
8086}
0 commit comments