feat: Enhance Header component to improve active link detection

- Updated the `isActive` function in `Header.jsx` to handle root path and include logic for other paths.

chore: Update package-lock.json to remove peer dependencies

- Removed unnecessary peer dependencies from various packages in `package-lock.json`.

feat: Update frameworks.json to include example links

- Changed `exemplo_codigo` to `exemplo` and added `exemplos` links for various frameworks in `frameworks.json`.

feat: Add placa images to series.json

- Included image paths for different ESP32 series in `series.json`.

feat: Create CodeExample component for displaying code snippets

- Added a new `CodeExample.jsx` component to fetch and display code examples dynamically.

feat: Add example Arduino code for Wi-Fi connection

- Created `arduino.ino` example for connecting to Wi-Fi.

feat: Add example code for audio playback using ESP-ADF

- Created `esp-adf.c` example for audio playback using ESP-ADF.

feat: Add example code for DSP operations

- Created `esp-dsp.c` example demonstrating basic DSP operations.

feat: Add example code for ESP-IDF LED blinking

- Created `esp-idf.c` example for blinking an LED using ESP-IDF.

feat: Add example code for Matter integration

- Created `esp-matter.c` example for Matter device initialization and event handling.

feat: Add example code for neural network operations

- Created `esp-nn.c` example demonstrating basic neural network operations.

feat: Add example code for face detection using ESP-WHO

- Created `esp-who.c` example for face detection using ESP-WHO library.

feat: Add MicroPython example for LED blinking

- Created `micropython.py` example for blinking an LED using MicroPython.
This commit is contained in:
Lucas Rayan committed 2025-10-22 23:10:30 -03:00
1 parent 3a5608d1de
commit 2a6699bbfb
18 files changed
+641 -112

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#include <WiFi.h>
// Substitua pelos dados da sua rede Wi-Fi
const char* ssid = "NOME_DA_SUA_REDE";
const char* password = "SENHA_DA_SUA_REDE";
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("Conectando ao Wi-Fi...");
WiFi.begin(ssid, password);
// Aguarda a conexão
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("Wi-Fi conectado com sucesso!");
Serial.print("Endereço IP: ");
Serial.println(WiFi.localIP());
}
void loop() {
// Aqui você pode colocar o código principal do seu programa
delay(1000);
}
+72
View File
@@ -0,0 +1,72 @@
#include "esp_log.h"
#include "audio_pipeline.h"
#include "audio_element.h"
#include "audio_event_iface.h"
#include "audio_common.h"
#include "i2s_stream.h"
#include "mp3_decoder.h"
#include "fatfs_stream.h"
#include "esp_peripherals.h"
#include "periph_sdcard.h"
static const char *TAG = "HELLO_ADF";
void app_main(void)
{
// Inicializa periféricos (como o SD card)
esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG();
esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg);
periph_sdcard_cfg_t sd_cfg = {
.root = "/sdcard",
};
esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sd_cfg);
esp_periph_start(set, sdcard_handle);
// Espera o SD card montar
periph_sdcard_wait_for_ready(sdcard_handle, portMAX_DELAY);
ESP_LOGI(TAG, "SD card montado!");
// Cria o pipeline
audio_pipeline_handle_t pipeline;
audio_pipeline_cfg_t pipeline_cfg = DEFAULT_AUDIO_PIPELINE_CONFIG();
pipeline = audio_pipeline_init(&pipeline_cfg);
// Elementos: arquivo (fatfs), decodificador (mp3) e saída (i2s)
audio_element_handle_t fatfs_stream_reader, i2s_stream_writer, mp3_decoder;
fatfs_stream_cfg_t fatfs_cfg = FATFS_STREAM_CFG_DEFAULT();
fatfs_cfg.type = AUDIO_STREAM_READER;
fatfs_stream_reader = fatfs_stream_init(&fatfs_cfg);
mp3_decoder_cfg_t mp3_cfg = DEFAULT_MP3_DECODER_CONFIG();
mp3_decoder = mp3_decoder_init(&mp3_cfg);
i2s_stream_cfg_t i2s_cfg = I2S_STREAM_CFG_DEFAULT();
i2s_cfg.type = AUDIO_STREAM_WRITER;
i2s_stream_writer = i2s_stream_init(&i2s_cfg);
// Registra e conecta elementos
audio_pipeline_register(pipeline, fatfs_stream_reader, "file");
audio_pipeline_register(pipeline, mp3_decoder, "mp3");
audio_pipeline_register(pipeline, i2s_stream_writer, "i2s");
audio_pipeline_link(pipeline, (const char *[]) {"file", "mp3", "i2s"}, 3);
// Define o arquivo MP3 a ser tocado
audio_element_set_uri(fatfs_stream_reader, "/sdcard/test.mp3");
// Inicia o pipeline
ESP_LOGI(TAG, "Iniciando pipeline...");
audio_pipeline_run(pipeline);
// Mantém o pipeline rodando
while (1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
// (Nunca chega aqui, mas seria o cleanup)
audio_pipeline_stop(pipeline);
audio_pipeline_wait_for_stop(pipeline);
audio_pipeline_terminate(pipeline);
}
+37
View File
@@ -0,0 +1,37 @@
#include <stdio.h>
#include "esp_dsp.h"
#define N 8 // Tamanho do vetor
void app_main(void)
{
// Vetor de entrada (exemplo de sinal)
float x[N] = {1.0, -2.0, 3.0, -4.0, 2.5, -1.5, 0.0, 4.5};
float y[N]; // Vetor de saída
// Inicializa o ESP-DSP
esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE);
if (ret != ESP_OK) {
printf("Erro ao inicializar o ESP-DSP!\n");
return;
}
printf("Sinal de entrada:\n");
for (int i = 0; i < N; i++) {
printf("%f ", x[i]);
}
printf("\n");
// Calcula o quadrado de cada valor
dsps_mulc_f32(x, y, N, 1.0f);
dsps_mul_f32(y, y, y, N, 1, 1, 1);
// Soma todos os quadrados
float soma = 0;
dsps_sum_f32(y, N, &soma, 1);
// Calcula a magnitude (raiz da soma dos quadrados)
float magnitude = sqrtf(soma);
printf("Magnitude do vetor: %f\n", magnitude);
}
+25
View File
@@ -0,0 +1,25 @@
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define LED_PIN GPIO_NUM_2 // LED onboard (ajuste conforme sua placa)
void app_main(void)
{
// Configura o pino do LED como saída
gpio_reset_pin(LED_PIN);
gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT);
while (1) {
// Liga o LED
gpio_set_level(LED_PIN, 1);
printf("LED ON\n");
vTaskDelay(pdMS_TO_TICKS(1000)); // Espera 1 segundo
// Desliga o LED
gpio_set_level(LED_PIN, 0);
printf("LED OFF\n");
vTaskDelay(pdMS_TO_TICKS(1000)); // Espera 1 segundo
}
}
+44
View File
@@ -0,0 +1,44 @@
#include <stdio.h>
#include "esp_log.h"
#include "esp_matter.h"
#include "esp_matter_controller.h"
#include "nvs_flash.h"
static const char *TAG = "esp-matter-example";
void app_event_cb(const esp_matter_event_t *event)
{
switch (event->event_id) {
case ESP_MATTER_EVENT_ATTRIBUTE_UPDATE: {
const esp_matter_attr_update_t *attr_update = &event->data.attr_update;
if (attr_update->endpoint_id == 1 && attr_update->cluster_id == ESP_MATTER_ON_OFF_CLUSTER_ID) {
bool on = false;
esp_matter_attribute_get(attr_update->endpoint_id, attr_update->cluster_id,
attr_update->attribute_id, &on);
ESP_LOGI(TAG, "Lâmpada %s", on ? "ligada" : "desligada");
}
break;
}
default:
break;
}
}
void app_main(void)
{
// Inicializa NVS
esp_err_t err = nvs_flash_init();
if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
ESP_ERROR_CHECK(nvs_flash_erase());
ESP_ERROR_CHECK(nvs_flash_init());
}
// Inicializa o Matter node
esp_matter::node_t *node = esp_matter::node::create(NULL, app_event_cb);
esp_matter::endpoint_t *endpoint = esp_matter::endpoint::create(node, ESP_MATTER_ENDPOINT_TYPE_ON_OFF_LIGHT);
// Inicia o stack Matter
ESP_ERROR_CHECK(esp_matter::start(node));
ESP_LOGI(TAG, "Dispositivo Matter iniciado. Aguardando comissionamento...");
}
+44
View File
@@ -0,0 +1,44 @@
#include <stdio.h>
#include "esp_nn.h"
#include "esp_nn_defs.h"
#define INPUT_SIZE 4
#define OUTPUT_SIZE 3
void print_array(const char *label, int16_t *array, int size) {
printf("%s: ", label);
for (int i = 0; i < size; i++) {
printf("%d ", array[i]);
}
printf("\n");
}
void app_main(void)
{
// Vetor de entrada (ex: saída de uma camada anterior)
int16_t input[INPUT_SIZE] = {1, 2, 3, 4};
// Pesos da camada densa (3x4)
int8_t weights[OUTPUT_SIZE * INPUT_SIZE] = {
1, -1, 2, 0,
0, 1, -1, 1,
2, 0, 1, -2
};
// Bias de cada neurônio
int16_t bias[OUTPUT_SIZE] = {10, -5, 0};
// Saída
int16_t output[OUTPUT_SIZE];
// Multiplicação da matriz: output = weights * input + bias
esp_nn_mul_mat_16x8_16(weights, input, bias, output,
OUTPUT_SIZE, INPUT_SIZE, /*shift=*/0);
print_array("Antes da ReLU", output, OUTPUT_SIZE);
// Aplicar função de ativação ReLU
esp_nn_relu_16(output, OUTPUT_SIZE);
print_array("Depois da ReLU", output, OUTPUT_SIZE);
}
+71
View File
@@ -0,0 +1,71 @@
#include "esp_camera.h"
#include "fd_forward.h" // Face Detection
#include "fr_forward.h" // Face Recognition
#include "human_face_detect_msr01.hpp"
#include "human_face_detect_mnp01.hpp"
#define CAMERA_MODEL_AI_THINKER // ou o modelo da sua placa
#include "camera_pins.h"
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println("Iniciando câmera...");
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_RGB565;
config.frame_size = FRAMESIZE_QVGA;
config.fb_count = 1;
if (esp_camera_init(&config) != ESP_OK) {
Serial.println("Falha ao iniciar a câmera!");
return;
}
Serial.println("Câmera inicializada com sucesso!");
}
void loop() {
camera_fb_t *fb = esp_camera_fb_get();
if (!fb) {
Serial.println("Falha ao capturar imagem!");
return;
}
// Detecta rostos na imagem
box_array_t *faces = face_detect_msr01(fb->buf, fb->width, fb->height, fb->format);
if (faces) {
Serial.printf("Rostos detectados: %d\n", faces->len);
for (int i = 0; i < faces->len; i++) {
box_t *box = &faces->box[i];
Serial.printf("Face %d - x:%d y:%d w:%d h:%d\n", i, box->box_p[0], box->box_p[1],
box->box_p[2] - box->box_p[0], box->box_p[3] - box->box_p[1]);
}
dl_lib_free(faces);
} else {
Serial.println("Nenhum rosto detectado.");
}
esp_camera_fb_return(fb);
delay(1000);
}
+11
View File
@@ -0,0 +1,11 @@
from machine import Pin
from time import sleep
# Define o pino 2 como saída (geralmente o LED embutido)
led = Pin(2, Pin.OUT)
while True:
led.value(1) # Liga o LED
sleep(0.5) # Aguarda 0,5 segundos
led.value(0) # Desliga o LED
sleep(0.5) # Aguarda 0,5 segundos