Introduction: Arduino Metronome (with ISR)
I play flute and I love Arduino so...why not to make a metronome with Arduino?
In this project I add a button to start and stop beats and to menage it I used interrupt technique.
- Arduino UNO
- 10 kΩ linear pot
- buzzer button
- 1 kΩ resistor
- some jumpers
Step 1: A Bit of Mathematics
Now, a bit of mathematics: Here the relation between bpm and bps:
bps = bpm / 60
Time between two pulses:
T = 1 / pbs
T = 1000 / pbs
So, pulse duration + silence duration = T
A good ratio between pulse duration and T is 1:10.
Delay time of "bip" [ms] = 6000 / bpm
Delay time of silence [ms] = 54000 / bpm
Step 2: Tone() and NoTone() Functions
To play sound with Arduino, use the following function:
To stop play sound:
Step 3: Upload Code
We have a be nice policy.
Please be positive and constructive.