const int s1 = 4;
const int s2 = 5;
const int s3 = 6;
const int s4 = 7;
const int s5 = 8;
const int s6 = 9;
const int s7 = 10;
const int s8 = 11;
const int s9 = 12;
const int s10 = 13;
int BT1 ;
int BT2 ;
int BT3 ;
int BT4 ;
int BT5 ;
int BT6 ;
int BT7 ;
int BT8 ;
int BT9 ;
int BT10 ;
int tombol = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(s1, INPUT_PULLUP);
pinMode(s2, INPUT_PULLUP);
pinMode(s3, INPUT_PULLUP);
pinMode(s4, INPUT_PULLUP);
pinMode(s5, INPUT_PULLUP);
pinMode(s6, INPUT_PULLUP);
pinMode(s7, INPUT_PULLUP);
pinMode(s8, INPUT_PULLUP);
pinMode(s9, INPUT_PULLUP);
pinMode(s10, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
BT1 = digitalRead(s1);
BT2 = digitalRead(s2);
BT3 = digitalRead(s3);
BT4 = digitalRead(s4);
BT5 = digitalRead(s5);
BT6 = digitalRead(s6);
BT7 = digitalRead(s7);
BT8 = digitalRead(s8);
BT9 = digitalRead(s9);
BT10 = digitalRead(s10);
if (BT1 == LOW) {
// turn LED on:
tombol = 1;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT2 == LOW) {
// turn LED on:
tombol = 2;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT3 == LOW) {
// turn LED on:
tombol = 3;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT4 == LOW) {
// turn LED on:
tombol = 4;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT5 == LOW) {
// turn LED on:
tombol = 5;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT6 == LOW) {
// turn LED on:
tombol = 6;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT7 == LOW) {
// turn LED on:
tombol = 7;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT8 == LOW) {
// turn LED on:
tombol = 8;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT9 == LOW) {
// turn LED on:
tombol = 9;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else if (BT10 == LOW) {
// turn LED on:
tombol = 10;
Serial.print ("Tombol ");
Serial.println(tombol);
delay(2000);
}else {tombol = 0;
Serial.print ("Tombol ");
Serial.println(tombol);};
}