Created
September 12, 2019 04:38
-
-
Save IsmailSan/d08a0bddee0e2be990ac1e715dceb073 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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