first commit

This commit is contained in:
2025-07-08 18:26:54 -06:00
commit d0fb62af9b
3 changed files with 55 additions and 0 deletions

2
main/CMakeLists.txt Executable file
View File

@ -0,0 +1,2 @@
idf_component_register(SRCS "maxxfan-controller.c"
INCLUDE_DIRS ".")

47
main/maxxfan-controller.c Executable file
View File

@ -0,0 +1,47 @@
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "esp_log.h"
// Define which GPIO pin to use (most ESP32 boards have LED on GPIO2)
#define LED_PIN GPIO_NUM_13
// Tag for logging
static const char* TAG = "BLINK";
void app_main(void)
{
ESP_LOGI(TAG, "Starting blink example!");
// Configure the GPIO pin as output
gpio_config_t io_conf = {
.pin_bit_mask = (1ULL << LED_PIN), // Bit mask for the pin
.mode = GPIO_MODE_OUTPUT, // Set as output mode
.pull_up_en = GPIO_PULLUP_DISABLE, // Disable pull-up
.pull_down_en = GPIO_PULLDOWN_DISABLE, // Disable pull-down
.intr_type = GPIO_INTR_DISABLE // Disable interrupt
};
// Apply the configuration
gpio_config(&io_conf);
ESP_LOGI(TAG, "GPIO configured! Starting blink loop...");
// Main loop
while(1) {
// Turn LED on
gpio_set_level(LED_PIN, 1);
ESP_LOGI(TAG, "LED ON");
// Wait 1 second
vTaskDelay(pdMS_TO_TICKS(1000));
// Turn LED off
gpio_set_level(LED_PIN, 0);
ESP_LOGI(TAG, "LED OFF");
// Wait 1 second
vTaskDelay(pdMS_TO_TICKS(1000));
}
}