Exercise 4 – Hierarchical states

You will define a composite state now. State hierarchies support the refinement of a behavior. To exercise this, you will add a motion sensor to the light controller:

Start with the statechart model included in this project:

The statechart

Adding motion sensor functionality

  1. Choose a state that you want to refine.
  2. Add a region to that state.
  3. Take a look at the error markers and begin adding states to the region.

Use the simulator to check the behavior. You can find a solution in the solutions project of this lesson.