Slide Potentiometer Module: 두 판 사이의 차이
잔글편집 요약 없음 |
잔글편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
{{#seo:|title= | {{#seo:|title=ArduWiki: Arduino Slide Potentiometer Guide|title_mode=append|keywords=Arduino, Computer Science, Maker Education, Performance Assessment, Slide Potentiometer, Arduino Project, Capstone Project, Arduino Example Code|description=Learn how to control a slide potentiometer using Arduino (basic info, circuit, example code). Useful for CS and maker classes.}}[[파일:슬라이드가변저항대표이미지.jpg|center|class=coders100]] | ||
[[ | |||
It's a component capable of varying resistance values. It can be used for adjusting volume or the brightness of light. | It's a component capable of varying resistance values. It can be used for adjusting volume or the brightness of light. | ||
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