Skip to content

Instantly share code, notes, and snippets.

@sankarcheppali
Created August 25, 2017 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sankarcheppali/29cc09d96f3f5173b05e509c901d5ec0 to your computer and use it in GitHub Desktop.
Save sankarcheppali/29cc09d96f3f5173b05e509c901d5ec0 to your computer and use it in GitHub Desktop.
blink task on esp32
#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