first commit
This commit is contained in:
6
CMakeLists.txt
Executable file
6
CMakeLists.txt
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
# The following five lines of boilerplate have to be in your project's
|
||||||
|
# CMakeLists in this exact order for cmake to work correctly
|
||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(maxxfan-controller)
|
||||||
2
main/CMakeLists.txt
Executable file
2
main/CMakeLists.txt
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
idf_component_register(SRCS "maxxfan-controller.c"
|
||||||
|
INCLUDE_DIRS ".")
|
||||||
47
main/maxxfan-controller.c
Executable file
47
main/maxxfan-controller.c
Executable 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user