Skip to content

Commit 705dbeb

Browse files
author
Martin O'Hanlon
committed
pot led example
1 parent 531be66 commit 705dbeb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/examples/pot_led.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from picozero import Pot, LED
2+
3+
# Potentiometer connected to GP26 (ADC0), GND and 3V
4+
# LED connected to GP0
5+
6+
pot = Pot(26)
7+
led = LED(0)
8+
9+
while True:
10+
led.value = pot.value

docs/recipes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ Print the value, voltage and percent reported by a potentiometer:
154154

155155
In the Thonny Python editor, choose View->Plotter to plot the output of :meth:`print`.
156156

157+
Use a potentiometer to control the brightness of an LED:
158+
159+
.. literalinclude:: examples/pot_led.py
160+
157161
Buzzer
158162
------
159163

0 commit comments

Comments
 (0)