/* Blink 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 "driver/gpio.h"
#define LED_PIN GPIO_NUM_18
#define LED_PIN2 GPIO_NUM_2
#define LED_PIN3 GPIO_NUM_4
#define LED_PIN4 GPIO_NUM_5
#define LED_PIN5 GPIO_NUM_19
#define BLINK_TIME 500
extern "C" void app_main()
{
uint8_t led_value = 0;
gpio_reset_pin(LED_PIN); //复位引脚
gpio_reset_pin(LED_PIN2);
gpio_reset_pin(LED_PIN3);
gpio_reset_pin(LED_PIN4);
gpio_reset_pin(LED_PIN5);
gpio_set_direction(LED_PIN ,GPIO_MODE_OUTPUT);//设置GPIO端口模式为输出
gpio_set_direction(LED_PIN2, GPIO_MODE_OUTPUT);
gpio_set_direction(LED_PIN3, GPIO_MODE_OUTPUT);
gpio_set_direction(LED_PIN4, GPIO_MODE_OUTPUT);
gpio_set_direction(LED_PIN5 ,GPIO_MODE_OUTPUT);
while (1) { //死循环要谨慎使用,一个进程里不能有超过一个以上死循环
gpio_set_level(LED_PIN,0==count);
gpio_set_level(LED_PIN2, 1==count);
gpio_set_level(LED_PIN3, 2==count);
gpio_set_level(LED_PIN4, 3==count);
gpio_set_level(LED_PIN5, 4==count);
led_value = !led_value; //将led_value的值取反,0->1,1->0
vTaskDelay(BLINK_TIME / portTICK_PERIOD_MS); //延时BLINK_TIME毫秒
count++;
if(count==5) {count=0;}
}
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C