int cislo = 0;
unsigned long int buducnost;
bool test = true;
void setup() {
pinMode(7, OUTPUT);
Serial.begin(9600);
pinMode(8, INPUT_PULLUP);
}
void loop() {
if(millis() > buducnost)
{
if(digitalRead(7) == LOW)
{
digitalWrite(7, HIGH);
}
else
{
digitalWrite(7, LOW);
}
buducnost = millis() + 500;
}
if(digitalRead(8) == LOW && test == true)
{
cislo++;
test == false;
Serial.println(cislo);
}
else if(digitalRead(8) == HIGH && test == false)
{
test == true;
}
}