Robin2:
All variables associated with millis() should be defined as unsigned long.
I want to have a negative value rather than positive 4000000000 when comparing
if ((sparkState == LOW) && (currentMillis - sparkPrevious >= sparkTime)
What i mean is that with "unsigned i get "currentMillis - sparkPrevious = 4000000000 something"
But with "long" i get "currentMillis - sparkPrevious = -5000"
"currentMillis - sparkPrevious" needs to be less or equal to "sparkTime", what is your opinion on that? Is there another way to make it work like this?
You should have a working variable that can copy the value from the ISR so that the ISR can change it again without screwing up further calculations.
For example
void loop()
{
int val = digitalRead(pickupPin);
noInterrupts();
unsignedLong wkgSparkPrevious = sparkPrevious;
interrupts();
// etc - and use wkgSparkPrevious everywhere outside the ISR
It is essential to turn interrupts off briefly so that the value of sparkPrevious does not change while you are copying it.
Aha! That seems to what have been screwing some things up for me! I have not yet completed the implementation of your proposed ISR system, i do get the interrupts just fine, but the other part of the code seems to not do what it is supposed to with the new variables. I will have to dig into that, could you guide me to an optimal way to troubleshoot my code with serialprints? Where is the best places to put serial print in my code?
noInterrupts();
unsignedLong wkgSparkPrevious = sparkPrevious;
interrupts();
It is essential to turn interrupts off briefly so that the value of sparkPrevious does not change while you are copying it.
So this so called "noInterrupts" and "Interrupts" are supposed to mean like, "detachInterrupt" and then "AttachInterrupt" is that what you ment here?
It might also be a good idea to include a flag variable in the ISR such as
newPulse = true;
and only read the value from the ISR when there is a new value.
What is the point of this? Will it make performance benefits? I am right now trying to replace my old interrupt with the one you provided in the link.
this is now the beginning of my loop, i even got rid of the serial.print in the ISR 
void loop()
{
if(! newISR) return;
Serial.println(revTime);
revTime = ISRrev;
revPrevious = prevISRmillis;
sparkPrevious = prevISRmillis;
newISR = false;
And this is the interrupt Routine with a kind of debounce i found online, what do you think of the debounce, is there a better way of doing it, hardware or software?
void sensorInterrupt()
{
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it's a bounce and ignore
if (interrupt_time - last_interrupt_time > 10)
{
unsigned long ISRmillis;
static unsigned long prevISRmillis;
ISRmillis = millis();
ISRrev = (millis() - prevISRmillis);
prevISRmillis = ISRmillis;
newISR = true;
}
last_interrupt_time = interrupt_time;
}
You seem to have revPrevious and sparkPrevious in the ISR both with the same value. That seems just a waste of CPU cycles.
Both of them needs to "remember" every interrupt, but only one of them (sparkPrevious) needs to also remember when sparkState went high. I see what you mean, but i haven't figured out how to make them 2 different values outside of the ISR.