const int Baudrate = 19200; const int Digital_Input_Pin = 3; // the pin that the heart-rate sensor is attached which contains INT0 //let op pin 2 bij handgemaakte experimenteerprint, pin3 bij pcb bordje van geert vdb void setup() { Serial.begin(Baudrate); // For sending data to the computer over USB pinMode(Digital_Input_Pin, INPUT); attachInterrupt(0, Send_Interval, RISING); // Attach to INT0 } void loop() { // nothing to do, its all in the interrupt handlers! } unsigned long LastTime, NewTime, j; void Send_Interval() { NewTime = micros(); // Resolution 4us, only one overrun in 70 minutes Serial.println(NewTime-LastTime, HEX); LastTime = NewTime; }