If I do understand correctly, pressing the first button sends a 00000001 to the variable.
Pressing the second sends a 00000010, the third a 00000100 and so on.
I try to evaluate that using the following code:
if (switchVar1 == 00000001){
Serial.println("treffer: 1");
}
if (switchVar1 == 0000010){
Serial.println("treffer: 2");
}
if (switchVar1 == 0000100){
Serial.println("treffer: 3");
if (switchVar1 == 00001000){
Serial.println("treffer: 4");
}
if (switchVar1 == 00010000){
Serial.println("treffer: 5");
}
if (switchVar1 == 00100000){
Serial.println("treffer: 6");
}
if (switchVar1 == 01000000){
Serial.println("treffer: 7");
}
if (switchVar1 == 10000000){
Serial.println("treffer: 8");
}
So when I press button 1, i get the result
"treffer 1" and the if-statement does what I expect.
But pressing the second, third ... button, never leads to a result like "treffer 2" or "treffer3".