//inisialisasi nomor pin
int btnPinG = 1;
int btnPinY = 2;
int bcBtnPin = 0;
int btnPinLED7 = 13;
int btnPinLED6 = 12;
int btnPinLED5 = 11;
int btnPinLED4 = 10;
int btnPinLED3 = 9;
int btnPinLED2 = 8;
int btnPinLED1 = 7;
int btnPinLED0 = 6;
//inisialisasi pin
void setup() {
// put your setup code here, to run once:
once :
pinMode(btnPinG, INPUT);
pinMode(btnPinY, INPUT);
pinMode(btnPinLED7, OUTPUT);
pinMode(btnPinLED6, OUTPUT);
pinMode(btnPinLED5, OUTPUT);
pinMode(btnPinLED4, OUTPUT);
pinMode(btnPinLED3, OUTPUT);
pinMode(btnPinLED2, OUTPUT);
pinMode(btnPinLED1, OUTPUT);
pinMode(btnPinLED0, OUTPUT);
}
void loop() {
//mode 2
bcBtnPin = digitalRead(btnPinG);
if(bcBtnPin == LOW){
digitalWrite(btnPinLED7, HIGH);
digitalWrite(btnPinLED0, HIGH);
delay(1000);
digitalWrite(btnPinLED7, LOW);
digitalWrite(btnPinLED0, LOW);
delay(1000);
digitalWrite(btnPinLED6, HIGH);
digitalWrite(btnPinLED1, HIGH);
delay(1000);
digitalWrite(btnPinLED6, LOW);
digitalWrite(btnPinLED1, LOW);
delay(1000);
digitalWrite(btnPinLED5, HIGH);
digitalWrite(btnPinLED2, HIGH);
delay(1000);
digitalWrite(btnPinLED5, LOW);
digitalWrite(btnPinLED2, LOW);
delay(1000);
digitalWrite(btnPinLED4, HIGH);
digitalWrite(btnPinLED3, HIGH);
delay(1000);
digitalWrite(btnPinLED4, LOW);
digitalWrite(btnPinLED3, LOW);
delay(1000);
}
//mode 7
bcBtnPin = digitalRead(btnPinY);
if(bcBtnPin == HIGH){
digitalWrite(btnPinLED4, HIGH);
delay(1000);
digitalWrite(btnPinLED4, LOW);
delay(1000);
digitalWrite(btnPinLED5, HIGH);
delay(1000);
digitalWrite(btnPinLED5, LOW);
delay(1000);
digitalWrite(btnPinLED6, HIGH);
delay(1000);
digitalWrite(btnPinLED6, LOW);
delay(1000);
digitalWrite(btnPinLED7, HIGH);
delay(1000);
digitalWrite(btnPinLED7, LOW);
delay(1000);
digitalWrite(btnPinLED0, HIGH);
delay(1000);
digitalWrite(btnPinLED0, LOW);
delay(1000);
digitalWrite(btnPinLED1, HIGH);
delay(1000);
digitalWrite(btnPinLED1, LOW);
delay(1000);
digitalWrite(btnPinLED2, HIGH);
delay(1000);
digitalWrite(btnPinLED2, LOW);
delay(1000);
digitalWrite(btnPinLED3, HIGH);
delay(1000);
digitalWrite(btnPinLED3, LOW);
delay(1000);
}
}