ESP 8266- PWM Generation

 void setup() {

  // Set PWM frequency to 10kHz

  analogWriteFreq(10000); 

  // Set PWM range to 100 for easy percentage (0-100)

  analogWriteRange(100);  

}


void loop() {

  // Set GPIO5 to 50% duty cycle (50/100)

  analogWrite(5, 50); //pin D1

}

Comments

Popular posts from this blog

System Bus Types, Functions, and Features

ESP 8266- Ultrasonic Sensor Interfacing

PIR Sensor Interfacing with ESP8266