RPM with other inputs

DC42

I tried compiling your suggestion but came across several problems. I am newbie so don't understand everything yet. this is what I have got

volatile unsigned long lastPulseTime;
volatile unsigned long pulseInterval;
unsigned long now;
unsigned long interval;
unsigned int rpm;

 void setup()
 {
   Serial.begin(9600);
   attachInterrupt(0, rpm_fun, FALLING);


 }



void rpm_func()
{
   now = micros();
  pulseInterval = now - lastPulseTime;
  lastPulseTime = now;
}

void loop()
{
  noInterrupts();
   interval = pulseInterval;
  interrupts;
   rpm = 60000000L/interval;
  ... // do something with 'rpm'
}