const int led=5;
const int tombol=2;
boolean hasilBaca;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(tombol, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
hasilBaca=digitalRead(tombol);
if(hasilBaca==1){
digitalWrite(led, HIGH);
Serial.println("nyala");
delay(100);
}else {
digitalWrite(led, LOW);
Serial.println("mati");
delay(100);
}
}