volatile int b=0;
int c1,c2;
void iii()
{
  b++;
}
void setup()
{
  c1=c2=0;
  attachInterrupt(0,iii,CHANGE);
  Serial.begin(9600);
  tone(3,1800);
}

void loop()
{
  // der kommer flere tællinger pr puls
  // så det her er en form for filter
  if (c1 < b) 
  {
    delay(100); // vent 100 milli sekunder for at faa ro igen
    c1 = b;
    c2++; 
    Serial.print(millis());
    Serial.print(" millisek tid - ");
    Serial.print(c2);
    Serial.println(" pulser");
  }
}

