1. Any way to make this more accurate?

Can anything be done to improve the timing accuracy of this program?

This program counts down from 5 to 0 and then pauses for a minute to allo=
w
me to count my pulse without looking at the screen.  At 55 seconds, it
starts to beep to warn me its almost time to stop.

--pulse.ex
procedure suspend(atom seconds)
    atom t
    machine_proc(38,1000) -- tick_rate
    t =3D time()
    while time() < t + seconds do
    end while
    machine_proc(38,0)
end procedure

for i =3D 5 to 1 by -1 do
    clear_screen()
    ? i
    machine_proc(1,5000) -- sound
    suspend(0.1)
    machine_proc(1,0)
    suspend(0.9)
end for

machine_proc(1,0)
suspend(1)
machine_proc(1,0)
suspend(54)
for i =3D 55 to 59 do
    machine_proc(1,0)
    suspend(0.1)
    machine_proc(1,0)
    suspend(0.9)
end for
machine_proc(1,0)
suspend(1)
machine_proc(1,0)
--end pulse.ex

--Alan
 =

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu