Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NguyenHaiChi #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions chip_info.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

#include <stdio.h>
#include <inttypes.h>
#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();
}
24 changes: 24 additions & 0 deletions ex1.c
Original file line number Diff line number Diff line change
@@ -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);
}