/* Multitasking Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define LED_RED GPIO_NUM_5
void turn_on(void * pv)
{
gpio_set_direction(LED_RED, GPIO_MODE_OUTPUT);
while (1) {
gpio_set_level(LED_RED, HIGH);
vTaskDelay(2000);
}
vTaskDelete( NULL );
}
void turn_off(void * pv)
{
gpio_set_direction(LED_RED, GPIO_MODE_OUTPUT);
while (1) {
gpio_set_level(LED_RED, LOW);
vTaskDelay(2000);
}
vTaskDelete( NULL );
}
extern "C" void app_main()
{
xTaskCreate(
&turn_on, // task function
"turn_on", // task name
2048, // stack size in words
NULL, // pointer to parameters
5, // priority
NULL); // out pointer to task handle
xTaskCreate(
&turn_off, // task function
"turn_off", // task name
2048, // stack size in words
NULL, // pointer to parameters
5, // priority
NULL); // out pointer to task handle
}