Potentiometer: Difference between revisions

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
No edit summary
Line 11: Line 11:


= How to connect it electrically =
= How to connect it electrically =
Text
[[File:PotiConnection1.png|300px]]
 
Image(s)


= How to control it in MicroPython =
= How to control it in MicroPython =
Line 32: Line 30:


Schematic drawing:
Schematic drawing:
[[File:PotiConnection1.png|300px]]
[[File:PotiConnection1.png|300px]]


= A small Program in MicroPython =
<syntaxhighlight lang="python" line='line'>
# todo
# code goes here
</syntaxhighlight>


text
image(s)


= Related Tutorial Videos =
= Related Tutorial Videos =


<youtube>gjj5KyK2qGI</youtube>
<youtube>gjj5KyK2qGI</youtube>
= Background =
text
image(s)

Revision as of 00:39, 30 August 2020

Description

A potentiometer is a resistor that can be mechanically changed. Typically form factors are knobs (turn to change) or sliders. The change of resistance is either linear (resistance changes linear with the angle or distance) or logarithmic.

Potentiometer

Slider

How to connect it electrically

How to control it in MicroPython

from machine import Pin, ADC
from time import sleep
pot = ADC(Pin(34))
pot.atten(ADC.ATTN_11DB)
while True:
  pot_value = pot.read()
  print(pot_value)
  sleep(0.5)

Here the voltage of Pin 34 is manipulable with the poti:

Schematic drawing:


Related Tutorial Videos