RPM sensor

Alright folks, I have been struggling with this one. I recently have started learning about attach.Interrupts and wanted to create an RPM timer using millis() and a little bit of math.
This is what I got, but gives me anywhere but a positive number.

I am using a halleffect sensor.
Please tell me how in the world I should fix my screwed up piece of code. I hope you can understand it the way I thought of it!

volatile int TestTimes, count, count1;
int RPM = 0;





void setup() {
 
attachInterrupt(0, Int, FALLING); // Initiate attach.Interrupt
Serial.begin(9600);

}

void loop() {

                                            
if(TestTimes>=2){                // To avoid multiple cycles messing with the computer, I have told it to stop after it 'falls' the second time.
 detachInterrupt(0);             // Give time for Serial monitor to process

   RPM = 1000/(count1-count)*60 ; 
  Serial.print(RPM);
  Serial.print("RPM");
  Serial.print('\n');
  RPM = 0;
}
  count1=count;                  // Make count1 equal to count so that count can hold the last value
  count = 0;
  attachInterrupt(digitalPinToInterrupt(0), Int, FALLING); 
  // Whenever pin goes from high to low

 
 }

 




void Int() {
count=millis(); // When the pin goes from low to high, record the time
TestTimes++;    // and the number of times its been here in one cycle
delay(10);
}

The recommended syntax of attachInterrupt(); is:

attachInterrupt(DigitalPinToInterrupt(pin), ISR_Name, Trigger_Level);:

1. arg1 (argument1) refers to the interrupt pin (2 or 3) of UNO. Is it 2 or 3 at which the output of your halleffet connected? Certainly it should not be at 0!

2. arg2 refers to the user defined ISR. Provide a meaningful name other than int.

3. arg3 refers to the active level of the pulse coming in from the halleffct sensor. You have assigned FALLING edge; this is correct.

Now, check your codes line-by-line.

Good Luck!

You clearly do NOT understand that an interrupt service routine must be lightening fast. You can NOT use delay() in an ISR.

The simplest way to measure RPM is to record the value of micros() whenever an interrupt is triggered and calculate the time since the last interrupt. if there is jut one interrupt per revolution then that will be the number of microsecs per revolution. Something like this (not complete, but should give the idea)

volatile unsigned long isrMicros;
unsigned long latestIsrMicros;
unsigned long previousIsrMicros;
volatile boolean newISR = false;


void loop() {
   if (newISR == true) {
     previousIsrMicros = latestIsrMicros; // save the old value
     noInterrupts(); // pause interrupts while we get the new value
        latestIsrMicros = isrMicros;
        newISR = false;
     interrupts(); 
     microsThisRev = latestIsrMicros - previousIsrMicos;
}

void myISR() {
   isrMicros = micros();
   newISR = true;
}

...R