const int buttonPin = 4;
const int ledPin = 2;
int currentState;
int lastState = LOW;
int ledState = LOW;
void setup(){
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
pinMode(buttonPin,INPUT);
}
void loop(){
currentState - digitalRead(buttonPin);
if (lastState == LOW && currentState == HIGH){
ledState = !ledState;
digitalWrite(ledPin,ledState);
Serial.println("stlacene");
}
else if (lastState == HIGH && currentState == LOW){
Serial.println("uvolnene");
}
lastState = currentState;
delay(50);
}