|
xentara-cpp-control v1.0.1
The Xentara C++ Control Framework
|
In this tutorial, we will extend the control class by introducing two hardcoded input values and an output value, which we will set within the step function. This demonstrates a basic control flow where inputs are read and used to determine an output.
In this tutorial, we will:
step function.Create a new header file called BasicControl.hpp. In this file, we will define two double input values, input1 and input2, and a double output variable, output.
Here is the code for BasicControl.hpp:
Now, create the implementation file, BasicControl.cpp. In this file, we will implement the initialize and step methods. The step method will add both the inputs to the output.
Here is the code for BasicControl.cpp:
In this example, the step method performs an arithmetic operation by adding input1 and input2 and storing the result in output. This simple operation demonstrates how a control function can use input values to perform calculations and set an output value. By assigning the result to output, this example also shows a basic control action, where inputs are processed to determine an output.
In this tutorial, we created a control with hardcoded inputs and a simple output. This example provides a basic control flow that will serve as a foundation for more dynamic input-output operations in future tutorials.