Skip to content

Instantly share code, notes, and snippets.

@IsmailSan
Created September 13, 2019 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IsmailSan/b1bda0a3d2e07c19d1596c90828c14c8 to your computer and use it in GitHub Desktop.
Save IsmailSan/b1bda0a3d2e07c19d1596c90828c14c8 to your computer and use it in GitHub Desktop.
#include <Arduino.h>
#include <PWM.h>
PWM pwm(GPIO_NUM_15); // Pin LED yang terhubung di ESPectro32
void setup() {
pwm.setFrequency(5000); // Frekuensi sinyal pwm
}
void loop() {
for (int i = 0; i <= 1023; i++) {
pwm.setDuty(i);
delay(10);
}
for (int i = 1023; i >= 0; i--) {
pwm.setDuty(i);
delay(10);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment