// Include Arduino FreeRTOS library
#include <Arduino_FreeRTOS.h>
// Include semaphore supoport
#include <semphr.h>
#define LED_BUILTIN 13
/*
* Declaring a global variable of type SemaphoreHandle_t
*/
SemaphoreHandle_t interruptSemaphore;
void setup() {
// Create task for Arduino led
xTaskCreate(TaskLed, // Task function
"Led", // Task name
128, // Stack size
NULL,
0, // Priority
NULL );
xTaskCreate(TaskLed1, // Task function
"Led", // Task name
128, // Stack size
NULL,
0, // Priority
NULL );
xTaskCreate(TaskLed2, // Task function
"Led", // Task name
128, // Stack size
NULL,
0, // Priority
NULL );
}
void loop() {
}
void TaskLed(void *pvParameters)
{
(void) pvParameters;
pinMode(LED_BUILTIN, OUTPUT);
for (;;) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
delay(1000);
}
}
void TaskLed1(void *pvParameters)
{
(void) pvParameters;
pinMode(8, OUTPUT);
for (;;) {
digitalWrite(8, !digitalRead(8));
delay(150);
}
}
void TaskLed2(void *pvParameters)
{
(void) pvParameters;
pinMode(9, OUTPUT);
for (;;) {
digitalWrite(9, !digitalRead(9));
delay(500);
}
}