This is the setup function where the serial port is initialised attachInterrupt(0, rpm, RISING);
and the interrupt is attached
the loop() method runs over and over again // as long as the Arduino has power
RISING: The current changes from off to on at 5 V.
To configure interrupts, use the following in void setup():
Here, 0 is for digital pin 2, 1 is for digital pin 3, function is the name of the function to call when the interrupt is triggered, and mode is one of the four modes that triggers the interrupt.