TimerHandle_t xTimer1;
TaskHandle_t xActieHandle = NULL;
void vTimer1CallBack(TimerHandle_t xTimer) {
xTaskNotifyGive(xActieHandle);
}
void actieTask(void *pvParameters)
{
uint32_t counter = 0;
while (true)
{
// Wacht tot er een waarde beschikbaar is
if (ulTaskNotifyTake(pdTRUE, portMAX_DELAY))
{
Serial.print("Notificatie ");
Serial.print(counter);
Serial.println(" ontvangen") ;
counter++ ;
}
}
}
void setup() {
Serial.begin(115200);
xTimer1 = xTimerCreate(
"actieTask",
pdMS_TO_TICKS(1000),
pdTRUE,
(void*)0,
vTimer1CallBack
);
xTaskCreate(
actieTask,
"verwerkTask",
2048,
NULL,
1,
&xActieHandle
);
xTimerStart(xTimer1, 0);
}
void loop() {}