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()
{
  if (c1 < b) 
  {
    c1 = b;
    c2++;
  }
  Serial.println(c2);
  delay(100);
}
