const int buttonPin1 = 2; // Pin untuk tombol 1
const int buttonPin2 = 3; // Pin untuk tombol 2
const int buttonPin3 = 4; // Pin untuk tombol 3
const int ledPin = 13; // Pin untuk LED indikator kipas
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (digitalRead(buttonPin1) == HIGH) {
blinkFanIndicator(1);
} else if (digitalRead(buttonPin2) == HIGH) {
blinkFanIndicator(3);
} else if (digitalRead(buttonPin3) == HIGH) {
blinkFanIndicator(10);
}
}
// put your main code here, to run repeatedly:
void blinkFanIndicator(int times) {
for (int i = 0; i < times; i++) {
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
}