Split Notes into FAQ and Recipes

Notes was always a bit of a "vague" section and half of it felt like
FAQs. Hopefully this is a little more consistent
This commit is contained in:
Dave Jones
2017-07-14 21:07:26 +01:00
parent 366c22e637
commit cb4276e897
4 changed files with 99 additions and 106 deletions

View File

@@ -24,6 +24,31 @@ example, if an LED was attached to "GPIO17" you would specify the pin number as
17 rather than 11:
.. image:: images/pin_layout.*
:align: center
Importing GPIO Zero
===================
In Python, libraries and functions used in a script must be imported by name
at the top of the file, with the exception of the functions built into Python
by default.
For example, to use the :class:`Button` interface from GPIO Zero, it
should be explicitly imported::
from gpiozero import Button
Now :class:`~gpiozero.Button` is available directly in your script::
button = Button(2)
Alternatively, the whole GPIO Zero library can be imported::
import gpiozero
In this case, all references to items within GPIO Zero must be prefixed::
button = gpiozero.Button(2)
LED
===