Created
August 25, 2017 12:51
-
-
Save sankarcheppali/29cc09d96f3f5173b05e509c901d5ec0 to your computer and use it in GitHub Desktop.
blink task on esp32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "freertos/FreeRTOS.h" | |
#include "freertos/task.h" | |
#include "driver/gpio.h" | |
void blink_task(void *pvParameter) | |
{ | |
//GPIO_NUM_16 is G16 on board | |
gpio_set_direction(GPIO_NUM_16,GPIO_MODE_OUTPUT); | |
printf("Blinking LED on GPIO 16\n"); | |
int cnt=0; | |
while(1) { | |
gpio_set_level(GPIO_NUM_16,cnt%2); | |
cnt++; | |
vTaskDelay(1000/portTICK_PERIOD_MS); | |
} | |
} | |
void app_main() | |
{ | |
xTaskCreate(&blink_task,"blink_task",1024,NULL,5,NULL); | |
printf("blink task started\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment