Hi, the code seems fine.
You're defining pin 5 as output, with pinMode(ledLahto,OUTPUT);
Have you connected a LED or something to pin 5?
Can you share a schema or a picture?
Also, can you try to print something to the serial monitor, in onLedKytkinChange
.
Something like
if(ledKytkin==true) {
Serial.println("LED ON");
digitalWrite(ledLahto, HIGH);
}
else {
Serial.println("LED OFF");
digitalWrite(ledLahto,LOW);
}
Warning: I haven't tested this code... in case a semicolon or a parenthesis is missing