Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Perform SW12 on a specific time


Maximus Jul 29, 2022 12:59 AM

I'm programming the LED lamp to turn on at a specific time by controlling the SW12 port.

It is difficult to light it up at a specific time, not every hour or every minute.

   - Every day beetween 04:00~07:00 and 17:00~20:00

   - Every 10 minutes to 30 seconds back and forth (Total 1 minute)

 ※ for example

    03:59:30 ~ 04:00:30

    04:09:30 ~ 04:10:30

    04:19:30 ~ 04:20:30

    ..........

I've tested it with functions such as "TimeIntoInterval" and "TimeIsBetween" as well as "IfTime", but it's not working well.

Is there a suitable examples or functions?

Thank you.


nsw Aug 3, 2022 01:47 PM

Hi, I think the below should do what you want :-

If (TimeIsBetween (239,421,1440,min) OR TimeIsBetween (1019,1201,1440,min)) AND (TimeIsBetween (570,600,600,Sec) OR TimeIsBetween (0,30,600,Sec)) Then
SW12 (SW12_1,1 )
Else
SW12 (SW12_1,0)
EndIf

All the contents of "If .... Then" are on one line.


Maximus Aug 5, 2022 06:15 AM

Oh, I think it's a really good way. I'll test it right now.

Thank you so much for your help!!!

Log in or register to post/reply in the forum.