Basic
15 min

Seq 01 — Fill, mix, drain

sequencetimersTONset-resetstepsstate-machine

Ready to build this?

Sign up free — no credit card required. This scenario requires the Basic plan.

Sign up to play this scenario →

Already have an account? Log in

Seq 01 — Fill, mix, drain

Briefing

A small batch machine runs three steps in a row: fill for 2 seconds, mix for 3, drain for 2. START begins the fill. Each step ends by starting the next and switching itself off, so only one output is on at a time. After the drain, everything is off. STOP ends the cycle at any moment. START pressed mid-cycle does nothing. Step 1 is built for you.

Objectives

  • START turns on FILL_VALVE only
  • After 2 s the fill ends and the MIXER runs alone
  • After 3 more seconds the mixer ends and DRAIN_VALVE runs alone
  • After 2 more seconds everything is off
  • STOP ends the cycle at any moment; START mid-cycle is ignored

Hints

  • Treat each step the same way: something switches it on, a timer measures it, and its timer ending is the event that moves the machine to the next step.
  • When a step's timer ends, two things must happen at that moment: the next step starts and the current one stops. Otherwise two outputs are on together.
  • The last step's timer ends the cycle: it stops its own output and starts nothing. STOP must end all three steps, not just the first.
  • Test mid-cycle: press START during the mix and press STOP during the mix. Neither START nor a leftover step may restart the cycle.

I/O Table

Inputs

START_PB

Start push-button (momentary NO)

BOOL · %I0.0

STOP_PB

Stop push-button (TRUE = pressed)

BOOL · %I0.1

Outputs

FILL_VALVE

Fill valve (step 1, 2 s)

BOOL · %Q0.0

MIXER

Mixer motor (step 2, 3 s)

BOOL · %Q0.1

DRAIN_VALVE

Drain valve (step 3, 2 s)

BOOL · %Q0.2

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1START → fill only

    The first step runs alone

  2. #2After 2.3 s → mix only

    The fill step ends and the mix step starts

  3. #3After 5.4 s → drain only

    The mix step ends and the drain step starts

  4. #4After 7.6 s → everything off

    The drain step ends the cycle

  5. #5STOP during the mix → everything off, and stays off

    STOP ends the cycle at any step

  6. #6START during the mix → nothing changes

    START only begins a cycle when every step is off

  7. #7START after a finished cycle → fill only

    A second cycle starts cleanly

Ready to build this?

Sign up free — no credit card required. This scenario requires the Basic plan.

Sign up to play this scenario →

Already have an account? Log in