Metronome
This activity belongs to the GeoGebra book The Domain of the Time.
Thanks to the seconds pendulum, the first precise clocks were made. This also led to the creation of the first metronomes..
SCRIPT FOR SLIDER anima
# Calculate the elapsed seconds dt; add one second if t1(1) < tt
SetValue(tt, t1(1))
SetValue(t1, First(GetTime(), 3))
SetValue(dt, (t1(1) < tt) + (t1(1) − tt)/1000)
# Move M. Visual and acoustic alert upon passing the vertical
SetValue(v, vt + dt gt)
If(x(M - O) x(M + dt v - O) < 0 ∧ play, PlaySound(sin(440 2Pi x), 0, 0.1))
SetValue(p, If(x(M − O) x(M + dt v − O) < 0, p + 1, p))
SetValue(M, M + dt v)
Author of the activity and GeoGebra construction: Rafael Losada.