// LED is connected to GPIO 2
const int ledPin = 2;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(ledPin, OUTPUT);
Serial.println("Hello, Ade Satria Hardinata!");
}
void loop() {
// increase the LED brightness
for(int dutyCycle = 0; dutyCycle < 255; dutyCycle++) {
// changing the LED brightness with PWM
analogWrite(ledPin, dutyCycle);
delay(3);
}
// decrease the LED brightness
for(int dutyCycle = 255; dutyCycle > 0; dutyCycle--) {
// changing the LED brightness with PWM
analogWrite(ledPin, dutyCycle);
delay(3);
}
}