diff --git a/chip_info.c b/chip_info.c new file mode 100644 index 0000000..d248345 --- /dev/null +++ b/chip_info.c @@ -0,0 +1,40 @@ + +#include +#include +#include "sdkconfig.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_chip_info.h" +#include "esp_flash.h" + +void app_main(void) +{ + esp_chip_info_t chip_info; + + esp_chip_info(&chip_info); + printf(" ESP32 Chip Name: %s\n", CONFIG_IDF_TARGET); + printf(" ESP32 vesion:%s\n ", esp_get_idf_version()); + + + printf("This is ESP32 chip with %d CPU core(s) , WiFi%s%s, model:%d \n ", + chip_info.cores, + (chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", + (chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "", + chip_info.model ); + + unsigned major_rev = chip_info.revision / 100; + unsigned minor_rev = chip_info.revision % 100; + printf("ESP32 revision v%d.%d \n ", major_rev, minor_rev); + + printf("%s flash\n",(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "Embedded" : "External"); + + printf("Minimum free heap size: %ld PRIu32 bytes\n", esp_get_minimum_free_heap_size()); + + for (int i = 5; i >= 0; i--) { + printf("Restarting in %d seconds...\n", i); + vTaskDelay(1000 / portTICK_PERIOD_MS); + } + printf("Restarting now.\n"); + fflush(stdout); + esp_restart(); +} diff --git a/ex1.c b/ex1.c new file mode 100644 index 0000000..aa648d5 --- /dev/null +++ b/ex1.c @@ -0,0 +1,24 @@ +#define pinLed 25 +#define button 21 +int buttonMode=0; + + +void IRAM_ATTR Interrupts(){ + buttonMode=digitalRead(button); +} +void setup(){ + Serial.begin(115200); + pinMode(pinLed, OUTPUT); + pinMode(button, INPUT); + attachInterrupt(digitalPinToInterrupt(button), Interrupts, CHANGE); + +} +void loop(){ + + if(buttonMode){ + digitalWrite(pinLed, LOW); + }else{ + digitalWrite(pinLed, HIGH); + } + delay(100); +}