esp32編程第一例 hollow word


#include<stdio.h>
#include"freertos/FreeRtos.h"
#include"freertos/task.h"
#include"esp_system.h" //esp32 系統操作庫
#include"esp_spi_flash.h" //閃存讀寫庫

/*
typedef struct {
esp_chip_model_t model; //!< chip model, one of esp_chip_model_t型號
uint32_t features; //!< bit mask of CHIP_FEATURE_x feature flags芯片功能
uint8_t cores; //!< cpu核心數
uint8_t revision; //!< chip revision number芯片版本號
} esp_chip_info_t;
*/
void app_main()
{
printf("hellow world!\n");//打印字符串
esp_chip_info_t chip_info;//定義芯片信息結構體變量
esp_chip_info(&chip_info);//
printf("cup數量%d,wifi%s%s",chip_info.cores,
(chip_info.features&CHIP_FEATURE_BT)?"/BT":"",
(chip_info.features&CHIP_FEATURE_BLE)?"/BLE":""
);
printf("芯片修訂號%d\n",chip_info.revision);
printf("%dMB %s flash\n",spi_flash_get_chip_size()/(1024*1024),
(chip_info.features&CHIP_FEATURE_EMB_FLASH)?"embedded":"external"
);
for(int i=10;i>=0;i--)
{
printf("倒計時%d秒\n",i);
vTaskDelay(1000/portTICK_PERIOD_MS);
}
printf("重啟\n");
fflush(stdout);//使stdout清空,就會立刻輸出所有在緩沖區的內容。
esp_restart();//芯片復位 函數位於esp_system.h
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM