int frequency = 5000; // Frekuensi sinyal pwm | |
int ledChannel = 5; // Pilih salah satu PWM channel 0-15 | |
int resolution = 10; // Resolusi sinyal : 8,10,12,15 | |
int ledPin = 15; // Pin LED yang terhubung di ESPectro32 | |
void setup() { | |
ledcSetup(ledChannel, frequency, resolution); | |
ledcAttachPin(ledPin, ledChannel); | |
} | |
void loop() { | |
Serial.println("10 % PWM"); | |
ledcWrite(ledChannel,102); | |
delay(500); | |
Serial.println("20 % PWM"); | |
ledcWrite(ledChannel,205); | |
delay(500); | |
Serial.println("40 % PWM"); | |
ledcWrite(ledChannel,410); | |
delay(500); | |
Serial.println("70 % PWM"); | |
ledcWrite(ledChannel,714); | |
delay(500); | |
Serial.println("100 % PWM"); | |
ledcWrite(ledChannel,1023); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment