code-sammler-flat-room-group-01a — ESP32-S3 simulation

An interactive ESP32-S3 circuit simulation you can run free in your browser on Velxio, by bmw550i.

Components

Sketch code

// Definiere die Pins und Parameter klar vorab
const int ledPin = 5;      // Der physikalische GPIO-Pin, an dem die LED hängt
const int pwmKanal = 0;    // Der LEDC-Kanal (0 bis 15 möglich, nutze 0 zum Testen)
const int frequenz = 5000; // 5 kHz Frequenz
const int aufloesung = 8;  // 8-Bit Auflösung (Werte von 0 bis 255)

void setup() {
  Serial.begin(115200);
  
  // 1. Setup des Kanals (Kanäle: 0-15)
  ledcSetup(pwmKanal, frequenz, aufloesung); 
  
  // 2. Verknüpfung des GPIO-Pins mit dem PWM-Kanal
  ledcAttachPin(ledPin, pwmKanal); 
}

void loop() {
  // LED fadet langsam hoch
  for (int dutyCycle = 0; dutyCycle <= 255; dutyCycle++) {
    ledcWrite(pwmKanal, dutyCycle); // Steuerung über den KANAL, nicht den Pin!
    delay(10);
  }
}

More projects by bmw550i