int redLedPin = 9; // Pin LED merah
int yellowLedPin = 10; // Pin LED kuning
void setup() {
pinMode(redLedPin, OUTPUT);
pinMode(yellowLedPin, OUTPUT);
}
void loop() {
// menyalakan lampu merah, meredupkan lampu kuning
analogWrite(redLedPin, 255); // lampu merah hidup (PWM 100%)
analogWrite(yellowLedPin, 10); // lampu kuning redup (PWM 10%)
delay(3000);
// Nyala lampu kuning, meredupkan lampu merah
analogWrite(redLedPin, 10); // lampu merah redup (PWM 10%)
analogWrite(yellowLedPin, 255); // lampu kuning hidup (PWM 100%)
delay(3000);
}