//This example is created by Mangesh Prabhudesai - Architect @ Tata Elxsi Ltd
//Button Part is not yet Implemented
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
//extern "C" void app_main();
TaskHandle_t myTask1Handle = NULL;
TaskHandle_t myTask2Handle = NULL;
#define BLINK_GPIO1 GPIO_NUM_7
#define BLINK_GPIO2 GPIO_NUM_8
void task1(void *arg)
{
gpio_pad_select_gpio(BLINK_GPIO1);
gpio_set_direction(BLINK_GPIO1, GPIO_MODE_OUTPUT);
while(1) {
printf("Turning off the LED\n");
gpio_set_level(BLINK_GPIO1, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Turning on the LED\n");
gpio_set_level(BLINK_GPIO1, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void setup()
{
Serial.begin(115200);
}
void task2(void *arg)
{
gpio_pad_select_gpio(BLINK_GPIO2);
gpio_set_direction(BLINK_GPIO2, GPIO_MODE_OUTPUT);
while(1)
{
printf("Turning off the LED\n");
gpio_set_level(BLINK_GPIO2, 0);
vTaskDelay(2000 / portTICK_PERIOD_MS);
printf("Turning on the LED\n");
gpio_set_level(BLINK_GPIO2, 1);
vTaskDelay(2000 / portTICK_PERIOD_MS);
}
}
void loop()
{
xTaskCreate(task1, "task1", 4096, NULL,10, &myTask1Handle);
xTaskCreate(task2, "task2", 4096, NULL, 9, &myTask2Handle);
while(1)
{
Serial.println("running");
delay(1500);
}
}