byte butonPini = 2; bool x = 1; void setup() { pinMode(butonPini, INPUT_PULLUP); Serial.begin(9600); } void loop() { if (digitalRead(butonPini) == 1 && x == 1) { Serial.println("var"); x = 0; } if (digitalRead(butonPini) == 0 && x == 0) { Serial.println("yok"); x = 1; } delay(100); }
Categories:
Tags:
No responses yet