// Left to Right LED pins
const int green = 23;
const int orange = 22;
const int red = 21;
// Right to Left LED pins
const int blue = 19;
const int sky = 18;
const int white = 5;
// Odds and Evens LED pins
const int odds1 = 17;
const int odds2 = 4;
const int evens1 = 16;
const int evens2 = 0;
void L2R(void * parameters) {
for(;;){
digitalWrite(green, HIGH);
digitalWrite(red, LOW);
vTaskDelay(350 / portTICK_PERIOD_MS);
digitalWrite(orange, HIGH);
digitalWrite(green, LOW);
vTaskDelay(350 / portTICK_PERIOD_MS);
digitalWrite(red, HIGH);
digitalWrite(orange, LOW);
vTaskDelay(350 / portTICK_PERIOD_MS);
}
}
void R2L(void * parameters) {
for(;;){
digitalWrite(white, HIGH);
digitalWrite(blue, LOW);
vTaskDelay(250 / portTICK_PERIOD_MS);
digitalWrite(sky, HIGH);
digitalWrite(white, LOW);
vTaskDelay(250 / portTICK_PERIOD_MS);
digitalWrite(blue, HIGH);
digitalWrite(sky, LOW);
vTaskDelay(250 / portTICK_PERIOD_MS);
}
}
void OddsEvens(void * parameters) {
for(;;){
digitalWrite(odds1, HIGH);
digitalWrite(odds2, HIGH);
digitalWrite(evens1, LOW);
digitalWrite(evens2, LOW);
vTaskDelay(150 / portTICK_PERIOD_MS);
digitalWrite(odds1, LOW);
digitalWrite(odds2, LOW);
digitalWrite(evens1, HIGH);
digitalWrite(evens2, HIGH);
vTaskDelay(150 / portTICK_PERIOD_MS);
}
}
void setup() {
pinMode(green, OUTPUT);
pinMode(orange, OUTPUT);
pinMode(red, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(sky, OUTPUT);
pinMode(white, OUTPUT);
pinMode(odds1, OUTPUT);
pinMode(evens1, OUTPUT);
pinMode(odds2, OUTPUT);
pinMode(evens2, OUTPUT);
Serial.begin(115200);
xTaskCreate(
L2R,
"Left to Right",
1000,
NULL,
1,
NULL
);
xTaskCreate(
R2L,
"Right to Left",
1000,
NULL,
1,
NULL
);
xTaskCreate(
OddsEvens,
"Odds and Even",
1000,
NULL,
1,
NULL
);
}
void loop() {
}