ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#21640 - 02/23/10 01:22 PM Offset from sunset >-120 minutes
Msradell Offline
junior


Registered: 08/19/07
Posts: 46
Loc: Louisville, Kentucky
I'm sure there is a simple solution to do this but it has me stumped. I would like to set up an event to happen more than 120 minutes before sunset. I can envision how to make it work by storing the sunset time to a variable than subtracting a constant and then comparing that to the time of day but I can't figure out how to write the code.

Thanks
_________________________
I've learned that there is a fine line between genius and insanity

Top
#21641 - 02/23/10 01:35 PM Re: Offset from sunset >-120 minutes [Re: Msradell]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6244
Loc: Montreal, QC, Canada
Yes, you can capture the sunset time in a variable (it is in minutes past midnight, and is calculated at midnight) and subtract the amount of minutes that you want from that. Then compare that value against the current time of day also captured to a variable (to also work in minutes past midnight).

IF Time of Day is < sunset // test sunset time
THEN Load Data to: Variable #0 // and capture in Var# 0
THEN Variable #0 - 210 //ex: You want 3.5 hours before sunset
TEHN Variable #1 = Variable #0 //save in variable #1

IF Time of Day is > 00:00 //test current time
THEN Load Data to: Variable #2 //save in variable #2

IF Variable #2 becomes = Variable #1 //if time is reached
THEN ...
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#21642 - 02/23/10 03:00 PM Re: Offset from sunset >-120 minutes [Re: Guy Lavoie]
Msradell Offline
junior


Registered: 08/19/07
Posts: 46
Loc: Louisville, Kentucky
Thanks!
_________________________
I've learned that there is a fine line between genius and insanity

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 5 anonymous users online.
Recent Posts
Get Latched -vs- Get Real Time I/O
by Guy Lavoie
Yesterday at 06:18 PM
New Ocelot driver for Elve!
by Deane Johnson
09/07/10 07:13 AM
How to Send an X10 Command ... propertly
by John Hughes
09/06/10 08:21 PM
To send an IR command
by John Hughes
09/05/10 08:28 PM
C-Max & OS X compatibility
by bvnoldguy
09/03/10 08:24 PM
Shout Box

Newest Members
Madon, jsdds, Dave W, stevenotts, wesmo
2633 Registered Users
Forum Stats
2633 Members
19 Forums
3727 Topics
22065 Posts

Max Online: 58 @ 12/05/07 03:33 PM
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