PadCodedocs

Start Timer

Runs steps over and over, every so many seconds, until it's stopped.

Category: Logic

#When to use it

Use it to repeat steps on a schedule: a countdown, a stopwatch, checking for new data every minute.

#Example

A focus timer's Start button:

  • Id: focus
  • Every: 1
  • Do: Set Value with State: secondsLeft and To: ⚡︎ → Formula… max(secondsLeft - 1, 0)

A Stop Timer with Id: focus stops it.

#Good to know

  • The first round runs after Every seconds, not straight away. Each round waits Every seconds after the last one finished.
  • The steps after Start Timer run right away; the timer runs on its own.
  • It keeps going on other screens, until a Stop Timer with the same Id, or until Preview closes.
  • Starting a timer with an Id that's already running replaces it.
  • A failure inside a round shows in Preview's debugger, and the timer keeps going.

#Add it

Select a view, open the Inspector's Actions tab, pick when it runs, tap Add action and choose Start Timer (under Logic). Tap the step to open its settings.

#Settings

SettingWhat it doesKindDefault
IdA name for the timer, to stop it later. Starting one with the same name replaces it.TextRequired
EverySeconds between runs.NumberRequired
DoThe steps to run each time.StepsRequired

#See also