1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <Arduino.h>
#include <Arduino_FreeRTOS.h>
void ledControllerTask(void *pvParameters);
const uint8_t *blueLed = (uint8_t *)13;
const uint8_t *redLed = (uint8_t *)12;
const uint8_t *greenLed = (uint8_t *)11;
void setup()
{
Serial.begin(115200);
xTaskCreate(ledControllerTask, "BLUE LED Task", 100, (void *)blueLed, 1, NULL);
xTaskCreate(ledControllerTask, "RED LED Task", 100, (void *)redLed, 1, NULL);
xTaskCreate(ledControllerTask, "GREEN LED Task", 100, (void *)greenLed, 1, NULL);
}
void ledControllerTask(void *pvParameters)
{
int pinNumber = *(uint8_t *)pvParameters;
Serial.println(pinNumber);
pinMode(pinNumber, OUTPUT);
while (1)
{
digitalWrite(pinNumber, digitalRead(pinNumber) ^ 1);
delay(200);
}
}
void loop(){}
|