void setup() {
// put your setup code here, to run once:
pinMode(9, OUTPUT);
pinMode(10, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
bool taster, schalte;
taster = digitalRead(10);
schalte = Schalter(taster);
digitalWrite(9, schalte);
}
//Taster als Schalter
bool Schalter (bool button)
{
static int status = 0;
if (button == true && status == 0){
digitalWrite(9, HIGH);
status++;
}
elif (button == false && status == 1){
digitalWrite(9, LOW);
status--;
}
return (status);
}