Jump to content
C4 Forums | Control4

Timers vs Delay

Recommended Posts

So I'm continuing my journey of C4 programming. I'm looking at the different Agents, and 'Timers' caught my eye. Now as far as capabilities, it appears that 'Delay' has a little more functionality - sub-second delays, timer is limited to 1 second resolution. I use Delay to implement blinking buttons, since the delay is about 500 ms.

Assuming the event requires > 1 second resolution, how does one choose timers or Delay?

Timers are easier to use for repeated events, but delays can do this as well, with a little help from auxiliary variables.

So - are there any implementation details that would affect whether one would use timers or Delay? Delay is a blocking call, which can simplify coding in simple (non-repetative) cases. Do timers work any better that they make up for the coding complexities of implementing one-off delays?

As an aside - since all this stuff is available in HE, would it really kill C4 to put out some docs on available functionality? I've got a metric crap-ton of attributes on various devices that I can twiddle, but no docs on what they do other than their names.

MSDN for C4, anyone? Maybe I should start a Wiki, and see if people will contribute to it to document things...

Link to comment
Share on other sites

MHotchin...hold off on the Wiki...I think there might be something coming online soon =)

I prefer times over delays in most instances. Delays stop all programming in the script, where timers can run in the back ground.

I typically only use delays in press and hold or multi-tap setup scenarios, but when you're after a tried and true delay, only a delay will do.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...