Skip to content

[Pro] Coffee Machine with C++ integration

This is a example for the deep C++ integration of YAKINDU statecharts. It shows how C++ classes can be used as variables and is based on the C example:


The statechart consists of two major states "ON" and "OFF". The "ON" state is a composite state with several substates and substate machines for the different modes.

Using deep C++ integration

Imported classes can be referenced by declaring a variable and using the class as the type of it. Within the example two classes are referenced:

  • var cm : Coffee_Machine
  • var hmi : CM_HMI
They can be used to access members of the class, like functions, variables, typedefs, etc. For example the class Coffe_Machine, which is declared as the variable cm, includes a function called stop heating: Functions


The declared variables can be used and changed in the simulation view.SimulationView

Generate state machine code

If you have changed the model you can generate state machine code by right-click on 'CoffeeMachine.sgen' and choose 'Generate Code Artefacts'. This will generate:

  • CoffeeMachineCpp.hpp
  • CoffeeMachineCpp.cpp
Download examples

Drag to install

Drag to your running itemis CREATE (min. version 2.8.0) workspace.

Back to overview