const int ledPin = 16; //LED attached to the GPIO16 pin on ESP32 development board const int ledPin2 = 23; //LED attached to the GPIO22 pin on ESP32 development board //PWM properties: const int freq = 5000; const int ledChannel = 0; const int resolution = 8; void setup(){ ledcSetup(ledChannel, freq, resolution);//LED PWM functionalitites //attach the channel to the GPIO to be controlled: ledcAttachPin(ledPin, ledChannel); ledcAttachPin(ledPin2, ledChannel); } void loop(){//changing LED brightness with PWM for(int dutyCycle = 0; dutyCycle <= 255; dutyCycle++){ //increase LED brightness ledcWrite(ledChannel, dutyCycle); delay(15); } for(int dutyCycle = 255; dutyCycle >= 0; dutyCycle--){//decrease LED brightness ledcWrite(ledChannel, dutyCycle); delay(15); } }