StateTick Docs Home →
States

Full Example: A Running State

One sweep: author a Running state that uses every action kind across all three groups, then instantiate and map it onto a real machine.

1. Have the pieces

You will reference an equipment (Motor with interface IMotor), some globals (PartCount), and an ST Logic Block (LineControl). A timer placeholder is named as you go.

2. Author the state

On Generic Composer → States, add a state, rename it Running, and fill the three groups with the + Add menu — an equipment action and a global action on entry, a timer and a logic block in steps, an equipment action on exit:

The Running state: On Entry SetSpeed(100) and SetPartCount(0); On Exit SetSpeed(0); Steps Timer.Start(DelayTimer) and Logic.Execute(LineControl)
Five actions, five kinds — equipment, global, timer, logic block — across On Entry, Steps and On Exit.
On Entry   Motor.IMotor.SetSpeed(100)
           Global.SetPartCount(0)
Steps      Timer.Start(DelayTimer)
           Logic.Execute('LineControl')
On Exit    Motor.IMotor.SetSpeed(0)

Click Save on the States page to commit it.

3. Instantiate in a composite

In the Composite Composer, on the composite's States section, + Add an instance and pick Running as its template. The action preview confirms what you built:

The Select State Template dialog previewing the Running template's OnEntry, Actions and OnExit
The template picker previews the state's actions before you commit.

4. Map to concrete hardware

Expand the instance and bind each generic action: MotorConveyor1.IMotor.Speed, the DelayTimer placeholder → a real timer (C1_MainDelay), LineControl → the Line1 logic-block instance. The global needs nothing. Status turns ✓ Mapped:

The fully mapped Running instance: SetSpeed to Conveyor1.IMotor.Speed, PartCount global, Timer.Start to C1_MainDelay, Logic.Execute to Line1, green Mapped status
The generic state, now a live mode of Conveyor1.

5. Reuse

That state is now a running mode of Conveyor1. Drop another instance of the same template into a different composite, map it to Conveyor2, and you have the identical behaviour on a second machine — the payoff of the whole chain: equipment + globals + logic blocks → state → composite mapping.

Try it in StateTick

Author a state machine once with generic actions, then map it to real hardware in every machine you build.

Get Started →