float rev = 0;
int time;
int old_time = 0;
int rpm;
void isr(){
rev++;
}
void setup() {
Serial.begin(9600);
attachInterrupt(1, isr, RISING); // 0 for 2 no. pin // 1 for 3 no. pin
}
void loop() {
delay(1000);
detachInterrupt(0);
time = millis() - old_time;
rpm = (rev/time) * 60000/3;
old_time = millis();
rev = 0;
Serial.print("RPM: ");
Serial.println(rpm);
attachInterrupt(1, isr, RISING);
}