Rotary Potentiometer
Overview
Adjusts the AO analog output by rotating the potentiometer, which can be combined with other modules for control adjustment.
Technical Specifications
Operating voltage: VCC 3.3V -5V
Module dimensions: 24*48mm
Mounting: 2 plastic building block compatible through-holes
Data type: Analog sampling value
Pin Definition
Pin |
Definition |
|---|---|
GND |
Ground |
VCC |
Power |
AO |
A nalog sampling value |
NC |
Not connected |
Example Code
Use the rotary sensor to control the brightness of the mPython Board RGB LED.
from mpython import *
import time
import math
p0 = MPythonPin(0, PinMode.ANALOG)
while True:
rgb.fill( (int((p0.read_analog() / 16)), int(0), int(0)) )
rgb.write()
time.sleep_ms(1)
time.sleep(0.1)