Skip to content

Commit

Permalink
2018-5-5 blink led after 1s delay
Browse files Browse the repository at this point in the history
2018-5-5 blink led after 1s delay
  • Loading branch information
xuhongv committed May 5, 2018
1 parent 8636ef8 commit de8a2ec
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions 2_blink_led/main/blink.c
Expand Up @@ -12,28 +12,23 @@
#include "driver/gpio.h"
#include "sdkconfig.h"

/* Can run 'make menuconfig' to choose the GPIO to blink,
or you can edit the following line and set a number here.
*/
//宏定义
#define BLINK_GPIO 16

void blink_task(void *pvParameter)
{
/* Configure the IOMUX register for pad BLINK_GPIO (some pads are
muxed to GPIO on reset already, but some default to other
functions and need to be switched to GPIO. Consult the
Technical Reference for a list of pads and their default
functions.)
*/
//短脚设置
gpio_pad_select_gpio(BLINK_GPIO);
/* Set the GPIO as a push/pull output */
//设置为输出
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while(1) {
/* Blink off (output low) */
//设置低电平
gpio_set_level(BLINK_GPIO, 0);
//延时1s
vTaskDelay(1000 / portTICK_PERIOD_MS);
/* Blink on (output high) */
//设置高电平
gpio_set_level(BLINK_GPIO, 1);
//延时1s
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
Expand Down

0 comments on commit de8a2ec

Please sign in to comment.