Potentiometer
Component | Potentiometer |
Type | Input |
Function | Setting a volume, scrolling in a menu, ... lots of rotating options. |
Introduction
A potentiometer is a type of variable resistor that is used to control the voltage in a circuit. It has three pins: the input pin, the output pin, and the wiper pin. The resistance between the input and output pins is constant, while the resistance between the wiper pin and the output pin changes based on the position of the wiper. This allows you to control the voltage in a circuit by adjusting the position of the wiper.
Pin Description
The potentiometer has three pins: the input pin, the output pin, and the wiper pin. The input pin is connected to the power supply, the output pin is connected to ground, and the wiper pin is connected to an analog pin on a microcontroller. You can use the analogRead function to read the voltage at the wiper pin and determine the position of the wiper.
Code Example
The following code example demonstrates how to read the voltage at the wiper pin of a potentiometer using an Arduino board.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
(This example uses the Serial library to print the voltage to the serial port. You can view the output using the Serial Monitor in the Arduino IDE.)