PulseIn para RPM ?

Se calhar até é fácil.. vou testar fazer isto:

 volatile byte rpmcount;
 unsigned int rpm;
 unsigned long timeold;
 
 int rmpfan1state=0;
 long intervalRPM = 8000; //8 segundos // 
 long previousMillis = 0;
  
 void setup()
 {
   Serial.begin(9600);
   attachInterrupt(0, rpm_fun, RISING);
   rpmcount = 0;
   rpm = 0;
   timeold = 0;
 }
 void loop()
 {
   if (rpmcount >= 20) { 
     //Update RPM every 20 counts, increase this for better RPM resolution,
     //decrease for faster update
     rpm = 30*1000/(millis() - timeold)*rpmcount;
     timeold = millis();
     rpmcount = 0;
     Serial.println(rpm,DEC);
   }
   
   unsigned long currentMillis = millis();
   if(currentMillis - previousMillis > intervalRPM) {
    previousMillis = currentMillis;
  if (rmpfan1state==1) rmpfan1state=0; 
  if (rmpfan1state==0) Serial.println("Fan DESLIGADA!");
	} 
 }
 
 void rpm_fun() //Each rotation, this interrupt function is run twice
 {
   rpmcount++;  
 rmpfan1state=1;[/b]
 }