const byte k1Switch = A0;
const byte k2Switch = A1;
const byte k3Switch = A2;
const byte k1Output = 11;
const byte k2Output = 10;
const byte k3Output = 9;
bool k1IsOn;
bool k2IsOn;
bool k3IsOn;
void setup() {
pinMode(k1Switch, INPUT_PULLUP);
pinMode(k2Switch, INPUT_PULLUP);
pinMode(k3Switch, INPUT_PULLUP);
pinMode(k1Output, OUTPUT);
pinMode(k2Output, OUTPUT);
pinMode(k3Output, OUTPUT);
}
void loop() {
k1IsOn = digitalRead(k1Switch);
k2IsOn = digitalRead(k2Switch);
k3IsOn = digitalRead(k3Switch);
if (k2IsOn or k3IsOn) {
digitalWrite(k1Output, k1IsOn ? HIGH : LOW);
}
else {
digitalWrite(k1Output, k1IsOn ? HIGH : LOW);
}
if (k1IsOn or k3IsOn) { // lather, rinse, repeat
// digitalWrite(k2Output, LOW);
//} else {
digitalWrite(k2Output, k2IsOn ? HIGH : LOW);
}
else {
digitalWrite(k2Output, k3IsOn ? HIGH : LOW);
}
if (!k1IsOn and !k2IsOn) {
// digitalWrite(k3Output, LOW);
//} else {
digitalWrite(k3Output, k3IsOn ? HIGH : LOW);
}
}