// Program: VariableFreq-E_v5.ino
// Wokwi: https://wokwi.com/projects/412917921801216001
#define LED 25 // define GPIO pin no. for the LED output
int freq = 1000; // initial PWM frequency
int resolution = 8;
void setup() {
Serial.begin(115200);
ledcAttach(LED, freq, resolution);
}
void loop() {
for (int frequency = 0; frequency <= 4000; frequency = frequency + 200) {
Serial.print("Frequency = ");
Serial.println(frequency);
// Write a new frequency to the output pin with a duty cycle of 50%
ledcWriteTone(LED, frequency);
delay(1500);
}
}