int brightness = 0;
int amount = 1;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
ledcSetup(0, 4000, 8);
ledcAttachPin(15, 0);
}
void loop() {
delay(10);
Serial.println(brightness);
brightness += amount;
ledcWrite(0, brightness);
if (brightness == 255 || brightness == 0) {
amount *= -1;
}
}