Source Tutorials Examples

Drakon.Tech Lift

In Drakon.Tech, a drakon flowchart can be either a function or a scenario. Function-flowcharts become the usual JavaScript functions. Scenario-flowcharts produce state machines that can accept events. Scenarios are suitable for control algorithms as well as long-running operations.

Look at this interactive lift example and click the buttons.

Loading...

Each button is a state machine made from the Button flowchart. The Button machine highlights the button under the mouse and makes the button clickable.

The algorithm that controls buttons

The openClose scenario controls the doors.

The algorithm that controls buttons

The Motor scenario moves the lift cabin up and down.

The algorithm that controls buttons

There is also a state machine called Program that describes the high-level logic of the lift. This logic defines how the lift reacts to user actions. The algorithm on the Program flowchart does other useful things, for example, it keeps track of where the lift is going, up or down.

The algorithm that controls buttons

This little demo could be written using event-based programming or other similar technics. The benefit with Drakon.Tech scenarios is that all the logic fits onto one visual scene. The control flow is not broken at points where the algorithm is waiting for events. As a result, one does not need to jump around over several functions to understand what can affect the behavior of the lift's motor.

Get the source code

To see the HTML, right-click on the Lift module, then click "Properties", and then "Edit HTML".

License: public domain.