Setup() {
Variables and other setup stuff goes HERE....
attachInterrupt(Loom_Pulse, GoHigh, RISING); // encoder pin on interrupt 0 (pin 2);
}
[COLOR="#0000FF"][B]Then when it detects a High Pulse....[/B][/COLOR]
void GoHigh() {
detachInterrupt(Loom_Pulse);
microseconds = micros();
attachInterrupt(Loom_Pulse, GoLow, FALLING); // encoder pin on interrupt 0 (pin 2);
}
[B][COLOR="#0000FF"]Then it waits for a Low Pulse....Does some Stuff then Resets the Interrupt to Looking for High.[/COLOR][/B]
void GoLow() {
detachInterrupt(Loom_Pulse);
if(indexer < numberOfEntries ) {
FlightTime = micros() - microseconds;
if ((indexer > 0) && (FlightTime > 5000) && (FlightTime < 100000) && (Break_Out ==0)) { //Eliminate readings below 5000 after Breakout and Restart
results[indexer] = FlightTime + MsecOffset;
pressure[indexer] = analogRead(analogPin);
indexer = indexer + 1;
}
if (indexer == 0) { //Throw away first measurement
indexer = indexer + 1;
}
}
Break_Out = 0;
attachInterrupt(Loom_Pulse, GoHigh, RISING); // encoder pin on interrupt 0 (pin 2);
}