# define LED1 8 # define SWITCH1 2 int switch1State = LOW; byte pState1 = 0; unsigned long pMillis1 = 0; unsigned long pausa1 =3000; void setup() { pinMode(LED1, OUTPUT); pinMode(SWITCH1, INPUT); } void loop(){ switch1State = digitalRead(SWITCH1); if (switch1State == HIGH) { if ( millis() - pMillis1 > pausa1) { pMillis1 = millis(); pState1 = HIGH; digitalWrite(LED1, pState1);}} }
Nessun commento:
Posta un commento