// Soft pulse (breathing) for COB LED filaments // XIAO ESP32-S3 Sense · GPIO1 · AO3400 MOSFET const int PWM_PIN = 4; // const int PWM_FREQ = 24989; // 1kHz — good for pulsing const int PWM_RES = 8; // 8-bit: 0–255 const int BREATHE_MS = 3000; // full cycle duration (ms) void setup() { ledcAttach(PWM_PIN, PWM_FREQ, PWM_RES); } void loop() { // Fade IN for (int i = 0; i <= 255; i++) { ledcWrite(PWM_PIN, i); delay(BREATHE_MS / 2 / 255); } // Fade OUT for (int i = 255; i >= 0; i--) { ledcWrite(PWM_PIN, i); delay(BREATHE_MS / 2 / 255); } }