Skip to content

Instantly share code, notes, and snippets.

@khthana
Created June 25, 2019 13:10
Show Gist options
  • Save khthana/00b308f9c5f0b6b9c71ea51eba315ee9 to your computer and use it in GitHub Desktop.
Save khthana/00b308f9c5f0b6b9c71ea51eba315ee9 to your computer and use it in GitHub Desktop.
#include <Arduino_FreeRTOS.h>
#define RED 6
#define YELLOW 7
#define BLUE 8
const uint16_t *blueLed = (uint16_t *) BLUE;
const uint16_t *redLed = (uint16_t *) RED;
const uint16_t *yellowLed = (uint16_t) YELLOW;
void setup() {
xTaskCreate(LedControllerTask, "RED LED Task", 128, (void *)redLed, 1, NULL);
xTaskCreate(LedControllerTask, "BLUE LED Task", 128, (void *)blueLed, 1, NULL);
xTaskCreate(LedControllerTask, "YELLOW LED Task", 128, (void *)yellowLed, 1, NULL);
}
void LedControllerTask(void *pvParameters)
{
pinMode(RED, OUTPUT);
pinMode(BLUE, OUTPUT);
pinMode(YELLOW, OUTPUT);
while (1)
{
delay(1000);
digitalWrite(pvParameters, digitalRead(pvParameters) ^ 1);
}
}
void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment