// Name: AL SHIJA P. ZABALA | Year/Sec: BSCpE-3C | Subject: RTES | Lab#: 10"
const int LED1 = 2;
const int LED2 = 0;
const int LED3 = 4;
const int LED4 = 5;
const int LED5 = 17;
const int LED6 = 16;
const int LED7 = 32;
const int LED8 = 33;
const int LED9 = 25;
const int LED10 = 26;
const int LED11 = 27;
void task1(void *parameters) {
for (;;) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
digitalWrite(LED1, HIGH);
vTaskDelay(1000 / portTICK_PERIOD_MS);
digitalWrite(LED2, HIGH);
vTaskDelay(500 / portTICK_PERIOD_MS);
digitalWrite(LED3, HIGH);
vTaskDelay(150 / portTICK_PERIOD_MS);
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
vTaskDelay(150 / portTICK_PERIOD_MS);
}
}
void task2(void *parameters) {
for (;;) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
digitalWrite(LED6, HIGH);
vTaskDelay(1000 / portTICK_PERIOD_MS);
digitalWrite(LED5, HIGH);
vTaskDelay(500 / portTICK_PERIOD_MS);
digitalWrite(LED4, HIGH);
vTaskDelay(150 / portTICK_PERIOD_MS);
digitalWrite(LED6, LOW);
digitalWrite(LED5, LOW);
digitalWrite(LED4, LOW);
vTaskDelay(150 / portTICK_PERIOD_MS);
}
}
void task3(void *parameters) {
for (;;) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
digitalWrite(LED7, LOW);
digitalWrite(LED8, HIGH);
digitalWrite(LED9, LOW);
digitalWrite(LED10, HIGH);
digitalWrite(LED11, LOW);
vTaskDelay(500 / portTICK_PERIOD_MS);
digitalWrite(LED7, HIGH);
digitalWrite(LED8, LOW);
digitalWrite(LED9, HIGH);
digitalWrite(LED10, LOW);
digitalWrite(LED11, HIGH);
vTaskDelay(150 / portTICK_PERIOD_MS);
}
}
void setup() {
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
pinMode(LED6, OUTPUT);
pinMode(LED7, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(LED9, OUTPUT);
pinMode(LED10, OUTPUT);
pinMode(LED11, OUTPUT);
xTaskCreate(task1, "Task1", 1000, NULL, 1, NULL);
xTaskCreate(task2, "Task2", 1000, NULL, 1, NULL);
xTaskCreate(task3, "Task3", 1000, NULL, 1, NULL);
}
void loop() {
}