long oldtime; long timegap; int pin = 13; int state = LOW; int counter= 0; void setup(){ Serial.begin(9600); pinMode(pin, OUTPUT); attachInterrupt(0, blink, RISING); } void loop(){ // Serial.print(oldtime); timegap= millis()-oldtime; if(timegap>1000){ // Serial.print(timegap); Serial.print(counter,BYTE); counter=0; oldtime = millis(); } //Serial.println(time); // wait a second so as not to send massive amounts of data // delay(1000); } void blink() { state = !state; digitalWrite(pin, state); counter++; }