Skip to content

Commit 9207b70

Browse files
author
Martin O'Hanlon
authored
Merge pull request #34 from RaspberryPiFoundation/dev
Push all change to master
2 parents 33880f9 + 485be47 commit 9207b70

File tree

17 files changed

+830
-384
lines changed

17 files changed

+830
-384
lines changed

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ A beginner-friendly library for using common electronics components with the Ras
1818
1919
Full documentation is available at `picozero.readthedocs.io <https://picozero.readthedocs.io>`_ :
2020

21-
- `Installation and getting started guide <https://picozero.readthedocs.ioen/latest/gettingstarted.html>`_
22-
- `Recipes and how-to's <https://picozero.readthedocs.ioen/latest/recipes.html>`_
23-
- `API <https://picozero.readthedocs.ioen/latest/api.html>`_
21+
- `Installation and getting started guide <https://picozero.readthedocs.io/en/latest/gettingstarted.html>`_
22+
- `Recipes and how-to's <https://picozero.readthedocs.io/en/latest/recipes.html>`_
23+
- `API <https://picozero.readthedocs.io/en/latest/api.html>`_
2424

25-
picozero is inspired by `gpiozero <https://gpiozero.readthedocs.io/en/stable/>`_ (and reuses some of its underlying struture), but is by design lighter weight and aligned with the Raspberry Pi Pico.
25+
picozero is inspired by `gpiozero <https://gpiozero.readthedocs.io/en/stable/>`_ (and reuses some of its underlying structure), but is by design lighter weight and aligned with the Raspberry Pi Pico.
2626

docs/api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ PWMLED
2424
:inherited-members:
2525
:members:
2626

27+
RGBLED
28+
----------
29+
30+
.. autoclass:: RGBLED
31+
:show-inheritance:
32+
:inherited-members:
33+
:members:
34+
2735
Button
2836
------
2937

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __getattr__(cls, name):
3232
return Mock()
3333

3434
sys.modules['machine'] = Mock()
35+
sys.modules['micropython'] = Mock()
3536

3637
# add the ticks_ms function to time (as it is in micropython)
3738
import time

docs/examples/button_function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from picozero import Button, pico_led
22
from time import sleep
33

4-
button = Button(17)
4+
button = Button(18)
55

66
def led_on_off():
77
pico_led.on()

docs/examples/button_is_pressed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from picozero import Button
22
from time import sleep
33

4-
button = Button(17)
4+
button = Button(18)
55

66
while True:
77
if button.is_pressed:

docs/examples/button_led.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from picozero import Button, pico_led
22

3-
button = Button(17)
3+
button = Button(18)
44

55
button.when_pressed = pico_led.on
66
button.when_released = pico_led.off

docs/examples/buzzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Active Buzzer that plays a not when powered
1+
# Active Buzzer that plays a note when powered
22
from time import sleep
33
from picozero import Buzzer
44

docs/examples/rgb_blink.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from picozero import RGBLED
2+
from time import sleep
3+
4+
rgb = RGBLED(1, 2, 3)
5+
6+
rgb.blink() # does not wait
7+
sleep(6)
8+
rgb.off()
9+
sleep(1)
10+
11+
# blink purple 2 seconds, off 0.5 seconds
12+
rgb.blink(on_times=(2, 0.5), colors=((1, 0, 1), (0, 0, 0)), wait=True, n=3)
13+
14+
rgb.off()
15+
sleep(1)
16+
17+
# blink red 1 second, green 0.5 seconds, blue 0.25 seconds
18+
rgb.blink((1, 0.5, 0.25), colors=((1, 0, 0), (0, 1, 0), (0, 0, 1)), wait=True, n=2)
19+

docs/examples/rgb_cycle.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from picozero import RGBLED
2+
from time import sleep
3+
4+
rgb = RGBLED(1, 2, 3)
5+
6+
# Gradually colour cycle through colours between red and green, green and blue then blue and red
7+
rgb.cycle()
8+
sleep(4)
9+
rgb.off()
10+
sleep(1)
11+
12+
# Colour cycle slower in the opposite direction
13+
rgb.cycle(fade_times=3, colors=((0, 0, 1), (0, 1, 0), (1, 0, 0)), wait=True, n=2)
14+
rgb.off()

docs/examples/rgb_pulse.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from picozero import RGBLED
2+
from time import sleep
3+
4+
rgb = RGBLED(1, 2, 3)
5+
6+
rgb.pulse() # does not wait
7+
sleep(6)
8+
rgb.off()
9+
sleep(1)
10+
11+
# 2 second to fade from purple to off, 0.5 seconds to change from off to purple
12+
rgb.pulse(fade_times=(2, 0.5), colors=((1, 0, 1), (0, 0, 0)), wait=True, n=3)
13+
14+
rgb.off()
15+
sleep(1)
16+
17+
# 4 seconds to change from red to green, 2 to change from green to blue, then 1 to change from blue back to red
18+
rgb.pulse((4, 2, 1), colors=((1, 0, 0), (0, 1, 0), (0, 0, 1)), wait=True, n=2)

0 commit comments

Comments
 (0)