Analog Input

Modified on Wed, 4 Jan, 2023 at 10:05 PM

In this example, you will see how to use the I/O Control Panels to monitor an analog input (a potentiometer on pin A0).


The use of a potentiometer is not required : you can replace it with any analog sensor you have, or you can even leave pin A0 unconnected and watch electrical noise on the analog input.



Wiring diagram

Connect a potentiometer on analog pin A0.

 

 


Sketch

Upload this program : 1_Basics \ 2_AnalogInput


In this program, we start by initializing our base library HITIComm with HC_begin().


Then we place HC_communicate() inside the loop() to continuously handle communication between your Arduino and HITIPanel. This function also retrieves in the background the I/O configuration and values.


#include <HITIComm.h>

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

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



Control Panels

1) Open the I/O Control Panels (“IO” button).

2) Turn the potentiometer knob and see the value changing accordingly in the Command Panel of pin A0.




Chart

1) Open the Chart window (CTRL+T or Tools\Chart).

2) Start data acquisition.



3) The chart continuously displays the last 5 seconds and add new values every 10ms. Turn the potentiometer knob and see the plot changing accordingly. Then stop data acquisition.


 

 




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 at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article