Author |
|
TonyNo Moderator Group
Joined: December 05 2001 Location: United States
Online Status: Offline Posts: 2889
|
Posted: December 20 2006 at 20:58 | IP Logged
|
|
|
While at Radio Shack a bit ago, they had a combo pack of a lamp and appliance module plus a plug-in controller for $19. The controller needed a purpose.
A project I wanted to do was a timer for the kitchen. The idea was to have various buttons with different amounts of time for cooking, etc. I made an overlay for the controller for 5, 10, 15, 20, 25, 30, 45, 60 minute times, plus a Timer Cancel button.
I set the controller to house code P and added a few formula triggers like this...
ph_macroparm ( "TIMER", N, 0, 0, 0, 0 )
where N is 5, 10, etc.
and for the Cancel button...
ph_killmacrowait ( "TIMER" ) [PLUS] ph_tts("Timer cancelled")
Here is the macro called by the triggers...
Jump if( ph_ismacrowaiting ( "TIMER" ) = 0, 3, 1)
Formula ph_playsound( "conf.wav", 0)
Jump 999
Formula ph_playsound( "processing.wav", 0)
Wait number("[LOCAL1]") * 60
Formula ph_macroparam("ANNOUNCE", "The timer you set has expired!", 3, 0, 0, 0)
The macro receives the timer value in TEMP1, plays a confirmation sound, and waits the approprite amount of time. When the timer expires, the system announces the time complete. This uses my TTS Announcement macro which checks if music is playing, and, if so, pauses playback for the announcement, then restarts the music after.
|
Back to Top |
|
|
theowl Groupie
Joined: February 24 2006 Location: United States
Online Status: Offline Posts: 59
|
Posted: January 20 2007 at 21:17 | IP Logged
|
|
|
This is cool, and I decided to set it up to improve the WAF. At first, it worked like a charm, then I heard "I wish I knew how much time was left".
So, here's my modification to increase the WAF even more.
First, a global timer called TIMEREXPIRES
Second, the timer macro...
First part, tests and triggers an announement if a timer is already active. This is where the minutes remaining comes from, just press any 'activate timer' button to find out.
10 Jump if ( ph_ismacrowaiting ( "TIMER" ) = 0, 3, 1)
20 TTS "There is already an active timer, which will expire in about " +round (ph_minutesafter(today(),ph_getglobal_dt("TIMEREXPIRES")),0) + " minutes."
30 Jump 999
Next part, we set a timer when one isn't active, calculate finishing time, and store time in global
40 TTS "Kitchen timer activated for [LOCAL1] minutes"
50 SetGlobal TIMEREXPIRES ph_relativedtpreci se(today(),(number("[LOCAL1]") * 60))
60 Wait number("[LOCAL1]") * 60
Finally, we reset the global, play a sound, and announce the timer.
70 SetGlobal TIMEREXPIRES 0
80 PlaySound C:\Waves\Sound Effect - Grandfather Clock Striking 8.wav
90 TTS "[LOCAL1] minute kitchen timer expired"
Triggers: Work exactly as you specified.
Doesn't conform exactly to yours, since I'm still trying to figure out why my pause/play macro's won't work...but the WAF jumped up enough so I could do a little DS10 wiring on the dryer!
Enjoy
|
Back to Top |
|
|
|
|