Exercise 3 – Orthogonal behavior

Now things are getting a little bit more complex. We will develop the next evolution of the light control:

Start with the statechart model included in this project.

The statechart

Detecting single and multi clicks.

As detecting double clicks is somehow independent from switching power it makes sense to make use of a new top-level region.

  1. Add a new region to the statechart and give it a name.
  2. Define states that react to button_down events and derived click events. A click event may have the number of clicks as its payload.

Use the simulation to check the behavior.

Processing click events

Change the states of the region light control to process click events in the way described above.

Hint: Be aware that the region that detects click events should be executed before the light control region. You can change the priority of the regions in the properties view.

lesson 3 step 2

Tidying up the definition section

Make use of named interfaces and internal declarations to properly structure the your definitions.

lesson 3 step 3