Slide Potentiometer Module: 두 판 사이의 차이
잔글편집 요약 없음 |
|||
| 14번째 줄: | 14번째 줄: | ||
* Jumper cables | * Jumper cables | ||
* Slide potentiometer module | * Slide potentiometer module | ||
* [[ | * [[LCD(Liquid Crystal Display) En|LCD1602]] | ||
== '''Connection''' == | == '''Connection''' == | ||
2025년 3월 27일 (목) 18:14 기준 최신판

It's a component capable of varying resistance values. It can be used for adjusting volume or the brightness of light.
Specifications
- Recommended Input Voltage: 3.3V ~ 5V
- Two analog output pins (output values are the same for both pins)
- 10Kohm
Example Required Hardware
- Arduino board
- Jumper cables
- Slide potentiometer module
- LCD1602
Connection
| Arduino | Slide Potentiometer Module | LCD |
| 5V | VCC, VCC | VCC |
| GND | GND, GND | GND |
| A4 | SDA | |
| A5 | SCL | |
| A6 | OTB | |
| A7 | OTA |

Example Code
This example demonstrates how to display the values from the slide potentiometer on an LCD screen.
Please refer to the link for instructions on using the LCD.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int otb = A6;
const int ota = A7;
int val1 = 0;
int val2 = 0;
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("OTA:");
lcd.setCursor(0, 1);
lcd.print("OTB:");
}
void loop() {
if (val1 != analogRead(ota)) {
val1 = analogRead(ota);
for (int i = 4; i < 8; i++) {
lcd.setCursor(i, 0);
lcd.print(" ");
}
lcd.setCursor(4, 0);
lcd.print(val1);
}
if (val2 != analogRead(otb)) {
val2 = analogRead(otb);
for (int i = 4; i < 8; i++) {
lcd.setCursor(i, 1);
lcd.print(" ");
}
lcd.setCursor(4, 1);
lcd.print(val2);
}
delay(300);
}
Execution Result