Potentiometer: Difference between revisions
Jump to navigation
Jump to search
Created page with "= Description = Text Image(s) = How to connect it electrically = Text Image(s) = How to control it in MicroPython = <syntaxhighlight lang="python" line='line'> # todo #..." |
|||
Line 12: | Line 12: | ||
= How to control it in MicroPython = | = How to control it in MicroPython = | ||
<syntaxhighlight lang="python" line='line'> | <syntaxhighlight lang="python" line='line'> | ||
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) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Here the voltage of Pin 34 is manipulable with the poti: | |||
[[File:PotiConnection2.jpg|300px]] | |||
Schematic drawing: | |||
[[File:PotiConnection1.png|300px]] | |||
= A small Program in MicroPython = | = A small Program in MicroPython = |
Revision as of 13:59, 20 August 2020
Description
Text
Image(s)
How to connect it electrically
Text
Image(s)
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:
A small Program in MicroPython
# todo
# code goes here
text
image(s)
Related Tutorial Videos
Background
text
image(s)