[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Clock



George Mills wrote:

> There is a change I've been meaning to make to the clock example
> for a long time but just did not take the time to do it.
> Here it is:
>
> Sidebar: Everyone has their pet peeve. One of my many is programs
> that have infinite loops. Here is a slight modification that
> uses ONLY the amount of CPU needed and leaves MSWLogo free
> to do other things. Example project would be draw 10 clocks with
> appropriate times around the world.
>
> Note that the LOOP procedure no longer calls itself and that
> the procedure MAIN returns immediately, but the clock keeps
> running !!!! This is fundamental in how programmers program
> today on modern systems. It's called event driven programming.
> What better event to use than an event timer to drive a clock.
>
> Another cool project would be to build a Stop Watch with
> Reset, Split, Elapse Time etc. Use the MOUSEON Function to
> to "Click" on Areas of the Stop Watch to perform the desired
> actions. Or build a watch with an alarm that uses your own
> voice to say "Wake up".
>
> to loop
> if not equalp :now word last bl item 4 time last item 4 time~
>    [erase_hands draw_hands]
> end
>
> to main
> setsc 0 cs
> face
> draw_hands
> settimer 1 1000 [loop]
> end

Hi George,

Good idea, thanx.

SETTIMER 1 1000 has a price: Follow carefully the seconds hand, and you will
see that occasionally it jumps in bigger leaps than one second. I reduced
the 1000 to 100 and now it behaves as expected.

Regards...

[[Yehuda]]





---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home