外部库文件调用 — Esp32 C6 simulation

An interactive Esp32 C6 circuit simulation you can run free in your browser on Velxio, by yaxin.

Components

Sketch code

// ESP32-C6-DevKitC-1 - blink GPIO8 + serial log.
// GPIO8 also drives the board's WS2812 RGB LED; a plain external LED (through
// a 220R resistor to GND) on the same header pin is what this blinks.
#define LED_PIN 8
#include <Bounce2.h>
#include "LedLib.h" // 引入自定义库

#define LED_PIN 13  // 假设 LED 接在 GPIO13

// 实例化 LED 对象
LedLib myLed(LED_PIN);


void setup() {
  attach(10,INPUT_PULLUP);
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
  Serial.println("ESP32-C6 ready");
  myLed.begin(); // 初始化 LED 引脚
      Serial.println("LED 库初始化完成!");
}

void loop() {
  myLed.toggle(); // 切换 LED 状态
    delay(1000);    //
  digitalWrite(LED_PIN, HIGH); delay(500);
  digitalWrite(LED_PIN, LOW);  delay(500);
  Serial.println("tick");
}

More projects by yaxin