打开hello_world 范例工程,把main.c下面程序替换以下代码
/* Hello World 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 "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
#include "hal/rtc_io_hal.h"
#include "driver/rtc_io.h"
int data = 0;
void blink(void* args)
{
for(int i = 7200000; i > 0; i--);
data++;
gpio_set_level(11, data % 2);
}
void app_main(void)
{
gpio_set_direction(11, GPIO_MODE_OUTPUT);
gpio_set_direction(10, GPIO_MODE_INPUT);
gpio_pullup_en(10);
gpio_set_intr_type(10, GPIO_INTR_NEGEDGE);
gpio_intr_enable(10);