User Tools

Site Tools


eeros_architecture:control_system:available_blocks:switch

This is an old revision of the document!


Switch

A switch block allows to select one of several input signals to write to its output. The code below shows a switch with 3 inputs where the second input is selected.

  Switch<3> sw;
  sw.switchToInput(1);

You can also query the index of the selected input with

  int index = sw.getCurrentInput();

Auto Switching

It is possible to configure a switch in such a way, that if the selected input reaches a given level within a small margin the switch does switch automatically. For this purpose you have to specify a condition with

  setCondition(T switchLevel, T delta, uint8_t index)

where switchlevel is the level the switch has to reach within the margin delta. index is the new index of the input. Before the switching can take place the switch must be armed with

  arm();

The function

  triggered();

queries the state of the switch function. It will return true as soon as the auto switching happened.

eeros_architecture/control_system/available_blocks/switch.1491478614.txt.gz · Last modified: 2017/04/06 13:36 by graf