Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I program an "alarm clock"

Hi,I need an expression to return 'true'for a moment when time of day (hours and minutes)are equal to Pot value.To my understanding I should comparefractional part of system time to pot value.However the following doesn't work:\..\$System.time-trunc(\..\$System.time)=PotClockSetThe PotClockSet settings are:minimum: 00:00:00maximum: 24:00:00resolution: 00.01:00Any ideas on how to get this "alarm clock" work.Thanks in advance,Sergei 
0 Kudos
Message 1 of 3
(3,349 Views)
.


Hi,

If all you need is a True signal when the current time equals a preset time (set by your Pot), you can use a TimeOfDay timer for this.

Here's how: Create a TimeOfDay Timer with the following properties:

Name = Timer1
On/Off signal = True
Timer Offset = PotClockSet
Timer durations = 0:05
Display format HH:MM:SS

Where PotClockSet is your pot used to set the time. Its properties are as you described in your question except the Resolution, which I made 1 second, i.e., 0:01.

Now, set the PotClockSet to whatever time you want the Alarm to go off. If you insert an expression on Timer1.status, you'll see that it is counting down to your Alarm time. And the implicit member Timer1 will go high for 5 seconds when the current time equals the set time.

Hope this he
lps.

khalid 🙂



.
0 Kudos
Message 2 of 3
(3,349 Views)
Hi,

It works great, thank you so much.

Sergei

Khalid wrote:

> .
>
> Hi,
>
> If all you need is a True signal when the current time equals a preset
> time (set by your Pot), you can use a TimeOfDay timer for this.
>
> Here's how: Create a TimeOfDay Timer with the following properties:
>
> Name = Timer1
> On/Off signal = True
> Timer Offset = PotClockSet
> Timer durations = 0:05
> Display format HH:MM:SS
>
> Where PotClockSet is your pot used to set the time. Its properties
> are as you described in your question except the Resolution, which I
> made 1 second, i.e., 0:01.
>
> Now, set the PotClockSet to whatever time you want the Alarm to go
> off. If you insert an expression on Timer1.status, you'll see that it
> is counting down to your Alarm time. A
nd the implicit member Timer1
> will go high for 5 seconds when the current time equals the set time.
>
> Hope this helps.
>
> khalid 🙂
0 Kudos
Message 3 of 3
(3,349 Views)