PaoloP:
Correggi if(pippo**==**1)
Grazie!! Cavolo, l'ho letto proprio stasera che = è un errore... '-.- ma non ci ho pensato...
void loop() {
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
t2=millis();
durata=t2 - t1;
Serial.print(durata);
}
else {
t1 = millis();
intervallo= t1 - t2;
Serial.print(" : ");
Serial.println(intervallo);
}
}if (durata >0)
{
pippo++;
}
if (pippo ==1)
{
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
delay(100);
}
// save the current state as the last state,
//for next time through the loop
}
Dovevo spostare anche la posizione del gruppo di if di pippo
Con un po' di lucidità ci torno a lavorare ![]()
Ancora grazie!!! ![]()