首页
随机
最近更改
特殊页面
社群首页
参数设置
关于WHY42
免责声明
WHY42
搜索
用户菜单
登录
欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。
查看“︁ESP32 led blink”︁的源代码
←
ESP32 led blink
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
<ref>https://github.com/espressif/esp-idf/tree/master/examples/get-started/blink</ref> Based on hello world project. = Add depndencies= Add gpio driver: <syntaxhighlight lang="cmake"> # fatal error: driver/gpio.h: No such file or directory idf_component_register(SRCS "hello_world_main.c" PRIV_REQUIRES spi_flash REQUIRES driver INCLUDE_DIRS "") </syntaxhighlight> Add lib: <syntaxhighlight lang="cpp"> idf.py add-dependency espressif/led_strip idf.py update-dependencies </syntaxhighlight> == Add menuconfig == Kconfig.projbuild: <syntaxhighlight lang="cpp"> menu "Example Configuration" orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps" choice BLINK_LED prompt "Blink LED type" default BLINK_LED_GPIO help Select the LED type. A normal level controlled LED or an addressable LED strip. The default selection is based on the Espressif DevKit boards. You can change the default selection according to your board. config BLINK_LED_GPIO bool "GPIO" config BLINK_LED_STRIP bool "LED strip" endchoice choice BLINK_LED_STRIP_BACKEND depends on BLINK_LED_STRIP prompt "LED strip backend peripheral" default BLINK_LED_STRIP_BACKEND_RMT if SOC_RMT_SUPPORTED default BLINK_LED_STRIP_BACKEND_SPI help Select the backend peripheral to drive the LED strip. config BLINK_LED_STRIP_BACKEND_RMT depends on SOC_RMT_SUPPORTED bool "RMT" config BLINK_LED_STRIP_BACKEND_SPI bool "SPI" endchoice config BLINK_GPIO int "Blink GPIO number" range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX default 8 help GPIO number (IOxx) to blink on and off the LED. Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink. config BLINK_PERIOD int "Blink period in ms" range 10 3600000 default 1000 help Define the blinking period in milliseconds. endmenu </syntaxhighlight> Configure it: <syntaxhighlight lang="bash"> idf.py menuconfig </syntaxhighlight> Select gpio and pin 8. Run: <syntaxhighlight lang="bash"> idf.py -p /dev/cu.usbmodem14201 -b 115200 flash </syntaxhighlight> [[Category:Embedded]] [[Category:ESP32]]
返回
ESP32 led blink
。