Skip to content

Commit 4596543

Browse files
author
Martin O'Hanlon
authored
Merge pull request #41 from RaspberryPiFoundation/dev
0.0.2
2 parents b6fd7f5 + 5eb3b5d commit 4596543

17 files changed

Lines changed: 240 additions & 46 deletions

docs/api.rst

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,58 @@ RGBLED
3232
:inherited-members:
3333
:members:
3434

35-
Button
35+
Buzzer
3636
------
3737

38-
.. autoclass:: Button
38+
.. autoclass:: Buzzer
3939
:show-inheritance:
4040
:inherited-members:
41-
:members:
41+
:members:
4242

43-
Switch
44-
------
43+
PWMBuzzer
44+
---------
4545

46-
.. autoclass:: Switch
46+
.. autoclass:: PWMBuzzer
4747
:show-inheritance:
4848
:inherited-members:
4949
:members:
5050

51+
Speaker
52+
-------
53+
54+
.. autoclass:: Speaker
55+
:show-inheritance:
56+
:inherited-members:
57+
:members:
5158

52-
RGBLED
59+
Button
5360
------
5461

55-
Buzzer
62+
.. autoclass:: Button
63+
:show-inheritance:
64+
:inherited-members:
65+
:members:
66+
67+
Switch
5668
------
5769

58-
Speaker
59-
-------
70+
.. autoclass:: Switch
71+
:show-inheritance:
72+
:inherited-members:
73+
:members:
6074

6175
Potentiometer
6276
-------------
6377

78+
.. autoclass:: Potentiometer
79+
:show-inheritance:
80+
:inherited-members:
81+
:members:
82+
6483
TemperatureSensor
6584
-----------------
6685

86+
.. autoclass:: TemperatureSensor
87+
:show-inheritance:
88+
:inherited-members:
89+
:members:

docs/changelog.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Change log
33

44
.. currentmodule:: picozero
55

6-
0.0.0 - yyyy-mm-dd
6+
0.0.1 - 2022-03-21
77
~~~~~~~~~~~~~~~~~~
88

9-
+ these things were released
9+
+ Initial alpha release to test installation process
10+

docs/developing.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
Development
22
===========
33

4-
Instructions on how to test, build and deploy picozero.
5-
6-
Test
7-
----
8-
9-
Not sure... pytest can probably be used but would have to mock `machine`.
4+
Instructions on how build and deploy picozero.
105

116
Build
127
-----
138

14-
1. Strip comments and docstrings from the source code to reduce file size (somehow).
15-
16-
2. Run `setup.py` and create a source distribution.:
9+
1. Run `setup.py` and create a source distribution.:
1710

1811
python3 setup.py sdist
1912

20-
3. Upload to PyPI:
13+
2. Upload to PyPI:
2114

2215
twine upload dist/*
2316

@@ -36,3 +29,4 @@ To build the documentation, run the following command from the docs directory:
3629

3730
The website will be built in the directory docs/_build/html.
3831

32+
Documentation can be viewed at http://picozero.readthedocs.io/

docs/gettingstarted.rst

Lines changed: 103 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,108 @@
1+
.. picozero: a library for controlling Raspberry Pi Pico GPIO pins with MicroPython
2+
..
3+
.. SPDX short identifier: MIT
4+
15
Getting Started
26
===============
37

4-
How to install...
8+
Requirements
9+
------------
10+
11+
A Windows, macOS or Linux computer with the `Thonny Python IDE`_ installed.
12+
13+
.. _Thonny Python IDE: https://thonny.org/
14+
15+
You can find information on how to install Thonny on the `Introduction to Raspberry Pi Pico guide`_.
16+
17+
.. _Introduction to Raspberry Pi Pico guide: https://learning-admin.raspberrypi.org/en/projects/introduction-to-the-pico/2
18+
19+
Once Thonny is installed you will need to ensure that you are using the latest MicroPython firmware. Details on how to install or update the Raspberry Pi Pico MicroPython firmware can be found on the `guide`_.
20+
21+
.. _guide: https://learning-admin.raspberrypi.org/en/projects/introduction-to-the-pico/3
22+
23+
Use the MicroPython interpreter
24+
-------------------------------
25+
26+
In Thonny, on the bottom right of the screen, there are options for changing the interpreter that you are using. Make sure that **MicroPython (Raspberry Pi Pico)** is selected.
27+
28+
.. image:: images/thonny-switch-interpreter.jpg
29+
30+
Install picozero from PyPi in Thonny
31+
------------------------------------
32+
33+
To install picozero within Thonny select **Tools** > **Manage packages...**
34+
35+
.. image:: images/thonny-manage-packages.jpg
36+
37+
Search for `picozero` on PyPi.
38+
39+
.. image:: images/thonny-packages-picozero.jpg
40+
41+
Click on install to download the package.
42+
43+
.. image:: images/thonny-install-package.jpg
44+
45+
Other install options
46+
---------------------
47+
48+
You can use the Thonny file manager to transfer a ``picozero.py`` file to Raspberry Pi Pico.
49+
50+
From the **View** menu, choose to see files.
51+
52+
.. image:: images/thonny-view-files.jpg
53+
54+
Either clone the picozero `GitHub repository`_ or copy the code from the `picozero.py`_ file and save it on your main computer.
55+
56+
.. _GitHub repository: https://github.com/RaspberryPiFoundation/picozero
57+
.. _picozero.py: https://raw.githubusercontent.com/RaspberryPiFoundation/picozero/master/picozero/picozero.py?token=GHSAT0AAAAAABRLTKWZDBSYBE54NJ7AIZ6MYSENI2A
58+
59+
In Thonny, navigate to the cloned directory or location you save the file to find the ``picozero.py`` file.
60+
61+
.. image:: images/thonny-navigate-downloads.jpg
62+
63+
Right click on the file and select the **Upload to /** option and you should see a copy of the ``picozero.py`` file on Raspberry Pi Pico.
64+
65+
.. image:: images/thonny-upload-files.jpg
66+
.. image:: images/thonny-copy-picozero.jpg
67+
68+
Write a program to control the onboard LED
69+
------------------------------------------
70+
71+
The following code will blink the onboard LED at a frequency of once per second.::
72+
73+
from picozero import pico_led
74+
from time import sleep
75+
76+
while True:
77+
pico_led.on()
78+
sleep(0.5)
79+
pico_led.off()
80+
sleep(0.5)
81+
82+
Run a program on your computer
83+
------------------------------
84+
85+
You can choose to run the program from your computer.
86+
87+
Click on the **Run current script button**.
88+
89+
.. image:: images/run-current-script.jpg
90+
91+
Choose to save the script on **This computer** and provide a filename.
92+
93+
.. image:: images/save-this-computer.png
94+
95+
Run a program on Raspberry Pi Pico
96+
----------------------------------
97+
98+
You can choose to run the program from Raspberry Pi Pico.
99+
100+
Click on the **Run current script button**.
101+
102+
.. image:: images/run-current-script.jpg
103+
104+
Choose to save the script on **Raspberry Pi Pico** and provide a filename.
5105

6-
How to write your first program which flashes the onboard LED
106+
.. image:: images/save-this-raspberry-pi-pico.png
7107

8-
How to run your program?
108+
If you call the file ``main.py`` it will run automatically when the Pico is powered.

docs/images/run-current-script.jpg

4.54 KB
Loading

docs/images/save-this-computer.png

4.71 KB
Loading
4.7 KB
Loading
19 KB
Loading
40 KB
Loading
81.7 KB
Loading

0 commit comments

Comments
 (0)