Hur skapar man en task i FreeRTOS för Arduino.
Exempel:
#include <Arduino.h>
#include <Arduino_FreeRTOS.h>
// Declare tasks
void ChargeTask( void *pvParameters );
void LedTask( void *pvParameters );
void ChargeFunction(void *pvParameters)
{
// Do some charge stuff
}
void LedTaskFunction(void *pvParameters)
{
// Do some LED stuff
}
void setup()
{
ChargeFunction
, (const portCHAR *)”ChargeFunktion” // A name just for humans
, 256 // This stack size can be adjusted by reading the Stack Highwater
, NULL
, 2 // Priority, with 3 (configMAX_PRIORITIES – 1) being the highest, and 0 being the lowest.
, NULL );
void loop()
{
for (;;){};// Nothing happens in loop. Everyting happends in deklared task-funktions …
}