How To Read The Data of The Potentiometer
How To Read The Data of The Potentiometer
In this lesson, we will learn how to read the data of the potentiometer and
convert the data into an angle.
2. Introduction of Potentiometer
Figure as below:
2
4. Reading the value of the potentiometer and
converting it into an angle
2. In the Tools toolbar, find Board and select Arduino Uno, as shown below:
Or:
3
3. Click Open in the File drop-down menu:
5. After opening, click to upload the code program to the Adeept Arm Drive
Board. If there is no error warning in the console below, it means that the Upload
is successful.
4
6. After successfully running the program, click to observe the value of the
Then open the serial monitor, you need to modify the displayed bit rate and
the bit rate set in the code to 115200, so that the display will not appear garbled.
You can observe the data changes corresponding to each button by rotating the
buttons of A0, A1, A2, A3, and A6. When the buttons of A0, A1, A2, and A3 are
rotated, the data change range is from 0 to 180. The data becomes smaller when
rotating clockwise, and the data becomes larger when rotating counterclockwise.
When the A6 button is rotated, the data change range is 35~90. When it is
rotated clockwise, the data becomes smaller, and when it is rotated
counterclockwise, the data becomes larger.
5
4.2. Learning the code of this lesson
Convert the value of 0~1023 to 0~180 proportionally, and then print out the
converted data to the serial monitor.
6
7