void setup() {
// put your setup code here, to run once:
pinMode(2, OUTPUT);
pinMode(13, INPUT_PULLUP);
Serial.begin(115200);
}
void Cek(int status) {
if(status == 0) {
Serial.println("MATI");
} else {
Serial.println("NYALA");
}
}
void loop() {
// put your main code here, to run repeatedly:
int status = digitalRead(13);
if(status == HIGH) {
digitalWrite(2, HIGH);
Serial.print("SWITCH AKTIF! Status : ");
Cek(status);
} else {
digitalWrite(2, LOW);
Serial.print("SWITCH NONAKTIF! Status : ");
Cek(status);
}
}