const int pins2 = 6; // switch ON
const int pins1 = 7; // Switch off
const int pinled = 8 ; // led output
void setup() {
pinMode(pinled, OUTPUT);
pinMode(pins2, INPUT);
pinMode(pins1, INPUT);
digitalWrite(pins1, HIGH);
digitalWrite(pins2, HIGH);
digitalWrite(pinled, LOW);
}
void loop() {
if (digitalRead(pins1) ==0 && digitalRead(pins2) ==1 ) {
digitalWrite(pinled, HIGH);
} else // jika tekan s2 led padam
if (digitalRead(pins2) == 0 && digitalRead(pins1) ==1 ) {
digitalWrite(pinled, LOW);
}
delay(300);
}