int led = 13;
int pb = 7;
int nilaipb = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(pb, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
nilaipb = digitalRead(pb);
if(nilaipb == 1){
digitalWrite(led, 1);
Serial.println("lampu sedang hidup");
}
else{
digitalWrite(led, 0);
Serial.println("lampu sedang mati");
}
}