Please help me with a timer

Hi all, I'm trying to perform an action (send an HTML POST command) ONLY every 5 seconds. I can't do it. can you help me?

Based upon what you have shown, this should be all you need:

1 Like

blocks

unfortunately this is not what I wanted. maybe I explained myself badly. I would like that:

  • the action that is launched by pressing button1 is launched only if more than 5 seconds have passed since the previous press.
  • if the button is pressed within 5 seconds from the previous press, a message appears saying "wait 5 seconds ..." Thank you very much

Ah, that is quite different :wink:

Let us see if we can come up with a solution for that. The easiest way would be to disable the button for five seconds, using a clock timer. You could change the text on the button to inform the user when it is ready to go again.

2 Likes

Try this (not tested)

When button is pressed the update is started and button disabled so it cannot be pressed again, until a) the previous request completes, b) five seconds is counted

You may want to add something for when the request fails (response code does not equal 200)

1 Like

OR maybe this way, smthing in general, with wait for specific seconds,

it works almost perfectly, but there is a problem. at the first click of the button, after the initialization of the screen, the action does not start, it is in fact in the waiting phase of 5 seconds. after the first click, waiting 5 seconds, then it works.

Please state which example code you are referring to Marco - TimAI2 or rnareshu?

It should work now, with one more layer of flag

rnareshu :slight_smile:

unfortunately it still doesn't work. behaves as before

This work perfect :wink: tnks

1 Like

It is working to me as per the problem defination, I have not included the web call etc.

  1. On start it is Green
  2. On click it become Red for atleast 5 seconds
  3. If clicked after 5 seconds it become Green again, and so on
    TimeFrame.aia (3.6 KB)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.