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口定义。

  • 相关阅读:
    idea安装破解
    项目中邮件发送
    (转)四种复制文件的效率高低
    备份
    关于时间
    转 累加含小数点的数据:parseFloat、toFixed等
    转 Java将PDF转换成图片
    (转)JAVA实现SFTP实例
    获取浏览器参数
    js 中日期转换
  • 原文地址:https://www.cnblogs.com/llw2017/p/9608676.html
Copyright © 2011-2022 走看看