#include <Arduino_FreeRTOS.h>
TaskHandle_t task_2_handle;
void setup() {
Serial.begin(9600);
xTaskCreate(task1, "send notification", 128, NULL, 2, NULL );
xTaskCreate(task2, "receive notification", 128, NULL, 2, &task_2_handle );
}
void loop()
{
// Empty. Things are done in Tasks.
}
void task1(void *pvParameters)
{
while(1){
Serial.println("Send a value of 10");
xTaskNotify(task_2_handle, 10,eSetValueWithOverwrite);
vTaskDelay( 5000 / portTICK_PERIOD_MS );
}
}
void task2(void *pvParameters)
{
uint32_t value;
while(1){
if (xTaskNotifyWait(0x00,0x01,&value, portMAX_DELAY)){
Serial.print("ValueReceived = ");
Serial.println(value);
}
}
}