Digital Data (Indicator)

Modified on Thu, 05 Jan 2023 at 02:00 PM

This example shows how to use a DIGITAL DATA Command Panel as an Indicator to monitor a boolean value inside your running Arduino program. An Indicator is typically used to monitor the status of your Arduino project (warnings, errors…) or the result of boolean operations (comparing numbers to check if a value was exceeded…).


To illustrate this, let’s perform a simple OR operation on 2 boolean values. We will use Command Panel 0 and 1 as Switches to set the value of the inputs, and use Command Panel 2 as an Indicator to watch the result of the operation.



Sketch

Upload this program : 1_Basics \ 7_DigitalData


Inside the loop(), we first read the 2 inputs (set from Command Panel 0 and 1) using HC_readDigitalData(data).


Then we perform the OR operation on the 2 inputs, and we finally display the result in Command Panel 2 using HC_writeDigitalData(data).


#include <HITIComm.h>

const int dd_input1 = 0;
const int dd_input2 = 1;
const int dd_result = 2;

void setup()
{
    // initialize library
    HC_begin();
}

void loop()
{
    // communicate with HITIPanel
    HC_communicate();

    // get inputs from HITIPanel (Command Panel 0 and 1)
    bool input1 = HC_digitalDataRead(dd_input1);
    bool input2 = HC_digitalDataRead(dd_input2);

    // OR operation
    bool result = input1 + input2;

    // display result in HITIPanel (Command Panel 2)
    HC_digitalDataWrite(dd_result, result);
}

 

 

Control Panels 

1) Display the DATA Control Panels (“DATA” button). 

2) Activate/deactivate the inputs and check the result of the OR operation.


 

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article