zoukankan      html  css  js  c++  java
  • esp32-智能语音-led驱动

    代码如下:

     1 /* Blink Example
     2 
     3    This example code is in the Public Domain (or CC0 licensed, at your option.)
     4 
     5    Unless required by applicable law or agreed to in writing, this
     6    software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
     7    CONDITIONS OF ANY KIND, either express or implied.
     8 */
     9 #include <stdio.h>
    10 #include "freertos/FreeRTOS.h"
    11 #include "freertos/task.h"
    12 #include "driver/gpio.h"
    13 #include "sdkconfig.h"
    14 
    15 /* Can run 'make menuconfig' to choose the GPIO to blink,
    16    or you can edit the following line and set a number here.
    17 */
    18 #define LED_GPIO CONFIG_LED_GPIO
    19 
    20 void blink_task(void *pvParameter)
    21 {
    22     /* Configure the IOMUX register for pad LED_GPIO (some pads are
    23        muxed to GPIO on reset already, but some default to other
    24        functions and need to be switched to GPIO. Consult the
    25        Technical Reference for a list of pads and their default
    26        functions.)
    27     */
    28     gpio_pad_select_gpio(LED_GPIO);
    29     /* Set the GPIO as a push/pull output */
    30     gpio_set_direction(LED_GPIO, GPIO_MODE_OUTPUT);
    31     while(1) {
    32         /* Blink off (output low) */
    33         gpio_set_level(LED_GPIO, 0);
    34         vTaskDelay(1000 / portTICK_PERIOD_MS);
    35         /* Blink on (output high) */
    36         gpio_set_level(LED_GPIO, 1);
    37         vTaskDelay(1000 / portTICK_PERIOD_MS);
    38     }
    39 }
    40 
    41 void app_main()
    42 {
    43     xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
    44 }

    案例使用了make menuconfig菜单来进行led IO口定义。

  • 相关阅读:
    PyPi 是什么
    Python 项目结构
    Python 四舍五入函数 round
    Discourse 备份时间的设置
    Discourse 如何限制存储到 S3 的备份文件数量
    PHP中关于 basename、dirname、pathinfo 详解
    PHP中的魔术方法和关键字
    PHP中的排序函数sort、asort、rsort、krsort、ksort区别分析
    mysql cursor游标的使用,实例
    mysql 存储过程
  • 原文地址:https://www.cnblogs.com/llw2017/p/9608676.html
Copyright © 2011-2022 走看看