ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#15770 - 05/15/06 04:55 PM Morning Alarm (Wake Up) Code???
sash18 Offline
journeyman


Registered: 08/31/05
Posts: 61
Loc: Melbourne
Hi Guy's,
I'm wondering if anyone has coded a morning wake up alarm that can be set using say a keypad (screen page) on the touchscreen rather than having to breakout into programming via c-max everytime you want to change the wake up time. Snooze button would be great also Anyone have a code like this or even an example so I can start coding it myself (both tch and prg files would be good if your sending them over)??

Kind Regards
Sash

Top
#15771 - 05/15/06 07:15 PM Re: Morning Alarm (Wake Up) Code??? [Re: sash18]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
I don't have a ready made routine but here is something that should get you started:

http://www.appdigusers.com/forum/showfla...SSID=#Post19830

The code in that routine is intended to be used as an alarm panel style keypad, but as the code shows you, its building up a variable as you press buttons, and can be cleared. All you have to do is have a statement that compares the variable against the time of day to create an alarm clock like function. You would enter 730 AM as "7", "3", "0" and the variable would contain 730. A statement like:

IF Time of Day becomes = Variable (x)
THEN ...

To have your wake up functionality.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#15772 - 05/15/06 07:53 PM Re: Morning Alarm (Wake Up) Code??? [Re: Guy Lavoie]
sash18 Offline
journeyman


Registered: 08/31/05
Posts: 61
Loc: Melbourne
Thanks Guy, dont you ever sleep man!
Top
#15773 - 03/08/07 09:13 AM Re: Morning Alarm (Wake Up) Code??? [Re: sash18]
edr Offline
junior


Registered: 01/20/03
Posts: 40
Loc: south jersey
try this.
it uses keypad from above.
looks at wakeup time and starts coffee 10 min before.
and graduly brightens lights.
hope you get the gist of it.

0106 - IF WAKE-UP-VALUE is =
WAKEUPVALUE // .
0107 - THEN WAKE-UP-MINUS-5 = WAKE-UP-VALUE // .
0108 - THEN WAKE-UP-MINUS-5 - 5 // .
0109 - THEN WAKEUP-COFFEE-START = WAKE-UP-VALUE // .
0110 - THEN WAKEUP-COFFEE-START - 10 // COFFEE START
0111 - IF Time of Day becomes = WAKE-UP-MINUS-5 // WAKE UP MINUS 5 MIN
0112 - AND 1=WEEKEND-2=WEEKDAY is = 2 // WEEKDAY
0113 - AND 0=HOME-1=AWAY is = 0 // HOME
0114 - THEN Send Module #6 -SPEAK-EZ FIVE-MORE-MINUTES // .
0115 - IF BEDROOM-KEYPAD-KEY-4, ON Command Pair // KEYPAD KEY 4 ON WD
0116 - OR Time of Day becomes = WAKE-UP-VALUE // .
0117 - AND 1=WEEKEND-2=WEEKDAY is = 2 // WEEKDAY
0118 - AND 0=HOME-1=AWAY is = 0 // HOME
0119 - THEN Send Module #6 -SPEAK-EZ GOOD-MORNING // .
0120 - THEN BEDROOM-FAN, Turn OFF // BED FAN.
0121 - THEN LIVING-AREA-CEILING-FANS, Turn OFF // CEILING FANS
0122 - THEN DINING-TRACK-LTS, Turn ON // DINING TRK.
0123 - THEN KITCHEN-COUNTER-LTS, Turn ON // KIT COUNTER LT.
0124 - THEN COFFEE-POT, Turn ON //
0125 - THEN Module #3 -SECU16-IR, CABLE-BOX IR CABLE-BOX-EXIT // CABLE EXIT
0126 - THEN Module #3 -SECU16-IR, CABLE-BOX IR CABLE-BOX-CH-0 // 0
0127 - THEN Module #3 -SECU16-IR, CABLE-BOX IR CABLE-BOX-CH-0 // 0
0128 - THEN Module #3 -SECU16-IR, CABLE-BOX IR CABLE-BOX-CH-6 // 6
0129 - THEN Module #3 -SECU16-IR, BIG-TV IR MAIN-TV-POWER // TV POWER
0130 - THEN Transmit X10, A - 10 // BATH LT
0131 - THEN Transmit X10, A - 6 // LIVING TRK
0132 - THEN Transmit X10, A - Bright (22), 8 time(s) // BRIGHT
0133 - THEN Transmit X10, B - 1 // BEDROOM LIGHT
0134 - THEN Transmit X10, B - Bright (22), 8 time(s) r


Edited by edr (03/08/07 09:20 AM)

Top
#15774 - 03/11/07 02:48 PM Re: Morning Alarm (Wake Up) Code??? [Re: edr]
blawre0000 Offline
junior
*

Registered: 04/01/06
Posts: 43
Loc: Scotland
This is my effort. I only put it into action the other day and it is not fully tried out. It seems to work ok. you might be able to pick out some bits to help.


0001 - IF Time of Day is > 00:00 //
0002 - THEN Load Data to: Variable #110 //
0003 - ELSE Load Data to: Variable #110 //
0004 - IF Variable #110 is = Variable #110 //
0005 - THEN Variable #111 = Variable #110 //
0006 - THEN Variable #111 / 60 //
0007 - THEN Variable #112 = Variable #111 //
0008 - THEN Variable #110 % 60 //
0009 - THEN Variable #113 = Variable #110 //
0010 - // xxxxxxxxxxxx
0011 - // ALARM CLOCK
0012 - IF 121, Button Ocelot is pressed // Alarm clock on or off
0013 - AND Variable #117 is = 0 //
0014 - THEN Variable #117 = 1 //
0015 - THEN Skip to line 115 //
0016 - IF 121, Button Ocelot is pressed //
0017 - AND Variable #117 is = 1 //
0018 - THEN Variable #117 = 0 //
0019 - // xxxxxxxxx
0020 - IF Variable #117 becomes = 1 // If Alarm is to be set then show on the buttons
0021 - //
0022 - //
0023 - //
0024 - // xxxxxxxxx
0025 - IF Variable #117 becomes = 0 // if Alarm is not to be set show on the buttons
0026 - THEN Variable #50 = 0 //
0027 - //
0028 - //
0029 - //
0030 - // xxxxxxxxxxxxxxxxxxx
0031 - // CHANGE ALARM CLOCK TIME
0032 - IF 112, Button Ocelot is pressed // hours
0033 - THEN Variable #115 + 1 //
0034 - IF Variable #115 becomes > 23 //
0035 - THEN Variable #115 = 0 //
0036 - IF 113, Button Ocelot is pressed //
0037 - AND Variable #115 is = 0 //
0038 - THEN Variable #115 = 23 //
0039 - THEN Skip to line 117 //
0040 - IF 113, Button Ocelot is pressed //
0041 - THEN Variable #115 - 1 //
0042 - //
0043 - //
0044 - //
0045 - //
0046 - IF 114, Button Ocelot is pressed // minutes
0047 - THEN Variable #116 + 1 //
0048 - IF Variable #116 becomes > 59 //
0049 - THEN Variable #116 = 0 //
0050 - IF 115, Button Ocelot is pressed //
0051 - AND Variable #116 is = 0 //
0052 - THEN Variable #116 = 59 //
0053 - THEN Skip to line 114 //
0054 - IF 115, Button Ocelot is pressed //
0055 - THEN Variable #116 - 1 //
0056 - // xxxxxxxxxxxxx
0057 - IF Variable #117 is = Variable #117 // convert hour and mins to var 118 for
0058 - THEN Variable #118 = Variable #115 // comparing with the real time
0059 - THEN Variable #119 = Variable #116 // ready to switch on the radio
0060 - THEN Variable #118 * 60 //
0061 - THEN Variable #118 + Variable #119 //
0062 - // xxxxxxxx
0063 - IF 114, Button Ocelot is pressed // if the time is changed
0064 - OR 115, Button Ocelot is pressed //
0065 - OR 112, Button Ocelot is pressed //
0066 - OR 113, Button Ocelot is pressed //
0067 - THEN Variable #120 = 1 // put to overide
0068 - THEN Variable #117 = 1 //
0069 - // xxxxxxxxxx
0070 - IF Variable #120 becomes = 0 // this will put it back to auto if brian at home
0071 - AND Variable #54 is = 0 // and we are at work
0072 - AND Variable #55 is = 0 // and Brian is home
0073 - THEN Variable #115 = 6 // set the time to 6-45
0074 - THEN Variable #116 = 45 //
0075 - // xxxxxxxxxx BRIAN AWAY TUESDAY
0076 - IF Variable #120 becomes = 0 // if over ride canceled
0077 - AND Variable #55 is = 1 // and Brian is away
0078 - AND Day of Week is = Monday (1) // set for 1 day ahead
0079 - THEN Variable #115 = 6 // set the time to 6-45
0080 - THEN Variable #116 = 45 //
0081 - // xxxxxxxx BRIAN AWAY REST OF WEEK
0082 - IF Variable #120 becomes = 0 // if over ride canceled
0083 - AND Variable #55 is = 1 // and brian is away
0084 - AND Day of Week is NOT = Monday (1) // set for 1 day ahead
0085 - AND Variable #56 is NOT = 0 //
0086 - THEN Variable #115 = 7 // set time to 7-45
0087 - THEN Variable #116 = 45 //
0088 - //
0089 - // xxxxxxxxxx
0090 - IF 158, Button Ocelot is pressed // BRIAN AWAY ON?OFF
0091 - AND Variable #55 is = 0 //
0092 - THEN Variable #55 = 1 //
0093 - THEN Skip to line 115 //
0094 - IF 158, Button Ocelot is pressed //
0095 - AND Variable #55 is = 1 //
0096 - THEN Variable #55 = 0 //
0097 - // xxxxxxxxx
0098 - IF Variable #55 becomes = 0 //
0099 - //
0100 - IF Variable #55 becomes = 1 //
0101 - //
0102 - //
0103 - // xxxxxxxxxxx
0104 - IF Variable #56 is = 0 //
0105 - AND Variable #120 is = 0 //
0106 - THEN Skip to line 120 //
0107 - IF Variable #57 becomes = Variable #118 // RADIO ON TIME
0108 - AND Variable #117 is = 1 // and the alarm cloc is set to on
0109 - THEN Variable #50 = 1 // then turn on the radio

Top
#15775 - 03/18/07 09:37 PM Re: Morning Alarm (Wake Up) Code??? [Re: blawre0000]
sash18 Offline
journeyman


Registered: 08/31/05
Posts: 61
Loc: Melbourne
Thanks guy's, I'll try and put both of those into practice as soon as I have more gadgets connected to my LEO 2.

Now that I know how to make things work based on an alarm style control set from the night before;

How would I get the LEO 2 to recognise that its a Saturday or Sunday if I base everything to happen on a daily basis without using the alarm clock system above?

Top
#15776 - 03/19/07 07:49 AM Re: Morning Alarm (Wake Up) Code??? [Re: sash18]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
Quote:


How would I get the LEO 2 to recognise that its a Saturday or Sunday if I base everything to happen on a daily basis without using the alarm clock system above?





Like this:

IF Day of Week is = 0 (Sunday)
OR Day of Week is = 6 (Saturday)
AND (any other conditions)
THEN ...

If you want to use this in several places, it would be best to create a flag variable. Then you just need to AND the variable with any other tests that need to know if its the weekend:

IF Day of Week is = 0 (Sunday)
OR Day of Week is = 6 (Saturday)
THEN Variable #x = 1
ELSE Variable #x = 0
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#15777 - 03/19/07 02:41 PM Re: Morning Alarm (Wake Up) Code??? [Re: Guy Lavoie]
sash18 Offline
journeyman


Registered: 08/31/05
Posts: 61
Loc: Melbourne
OOOOOOO this is good, thanks guy's/guy....lol

Cheer's
Sash

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie, Bobkat 
Hop to:
Who's Online
0 registered and 65 anonymous users online.
Recent Posts
Ocelot Battery
by ADI Tech Support
Today at 07:38 AM
Comms Retry Error
by HDTVPete
09/18/17 04:04 PM
Cmax Message: Failed to set data for a 'delay'
by HDTVPete
09/16/17 04:36 PM
Shout Box

Newest Members
brigiel, vevevie, zhutree, 416, saiqul
3003 Registered Users
Forum Stats
3003 Members
19 Forums
4002 Topics
23435 Posts

Max Online: 132 @ 11/13/16 10:07 AM
September
Su M Tu W Th F Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30