用了blink案例,光有打印,没有灯闪

carlostyq
Posts: 1
Joined: Mon May 24, 2021 4:25 pm

用了blink案例,光有打印,没有灯闪

Postby carlostyq » Mon May 24, 2021 5:02 pm

用的是esp/esp-idf/examples/get-started/blink的案例,烧录进ESP32-C3-DevKitM-1的开发板中。
打开监视器看,只有"Turning off the LED"/ "Turning on the LED"的交替打印,但是灯没有闪。
  1. #define BLINK_GPIO CONFIG_BLINK_GPIO
  2.  
  3. void app_main(void)
  4. {
  5.     /* Configure the IOMUX register for pad BLINK_GPIO (some pads are
  6.        muxed to GPIO on reset already, but some default to other
  7.        functions and need to be switched to GPIO. Consult the
  8.        Technical Reference for a list of pads and their default
  9.        functions.)
  10.     */
  11.     gpio_reset_pin(BLINK_GPIO);
  12.     /* Set the GPIO as a push/pull output */
  13.     gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
  14.     while(1) {
  15.         /* Blink off (output low) */
  16.         printf("Turning off the LED\n");
  17.         gpio_set_level(BLINK_GPIO, 0);
  18.         vTaskDelay(1000 / portTICK_PERIOD_MS);
  19.         /* Blink on (output high) */
  20.         printf("Turning on the LED\n");
  21.         gpio_set_level(BLINK_GPIO, 1);
  22.         vTaskDelay(1000 / portTICK_PERIOD_MS);
  23.     }
  24. }
编译指令如下:
475 get_idf
476 idf.py set-target esp32c3
477 idf.py menuconfig
(Top) → Component config → ESP32C3-Specific → Minimum Supported ESP32-C3 Revision--->Rev 2
478 idf.py build
479 idf.py -p /dev/ttyUSB0 flash

ESP_Gargamel
Posts: 786
Joined: Wed Nov 14, 2018 8:45 am

Re: 用了blink案例,光有打印,没有灯闪

Postby ESP_Gargamel » Tue May 25, 2021 2:55 am

ESP32-C3-DevKitM-1 开发板不是直接用的 GPIO 控制 LED,而是使用了 WS2812。v4.3 上的 blink 还是老的,需要使用 master 上的 blink。

Who is online

Users browsing this forum: Baidu [Spider] and 150 guests