int pin = 7;
int timeout = 4;
unsigned long duration;
void setup() {
Serial.begin(9600);
pinMode(pin, INPUT_PULLUP);
}
void loop() {
duration = pulseInLong(pin, LOW, timeout*1000000);
Serial.print(duration);
// warten bis wieder high
while (digitalRead(pin) == LOW) {
delay(100);
}
Serial.println(" ready");
}