Merge pull request #63 from waveform80/fix-notes-2

Fix Notes
This commit is contained in:
Dave Jones
2015-10-12 22:18:38 +01:00
2 changed files with 63 additions and 72 deletions

View File

@@ -15,6 +15,7 @@ The latest release is **v0.7.0 beta 2** released on 9th October 2015.
With very little code, you can quickly get going connecting your physical With very little code, you can quickly get going connecting your physical
components together: components together:
```python
from gpiozero import LED, Button from gpiozero import LED, Button
led = LED(2) led = LED(2)
@@ -22,6 +23,7 @@ components together:
button.when_pressed = led.on button.when_pressed = led.on
button.when_released = led.off button.when_released = led.off
```
The library includes interfaces to many simple everyday components, as well as The library includes interfaces to many simple everyday components, as well as
some more complex things like sensors, analogue-to-digital converters, full some more complex things like sensors, analogue-to-digital converters, full

View File

@@ -45,13 +45,10 @@
The following program looks like it should turn an LED on: The following program looks like it should turn an LED on:
```python
from gpiozero import led from gpiozero import led
led = LED(2) led = LED(2)
led.on() led.on()
```
And it does, if you're using the Python shell, IPython shell or IDLE shell, And it does, if you're using the Python shell, IPython shell or IDLE shell,
but if you saved this program as a Python file and ran it, it would flash but if you saved this program as a Python file and ran it, it would flash
@@ -60,16 +57,12 @@
The following file includes an intentional `pause` to keep the program The following file includes an intentional `pause` to keep the program
alive: alive:
```python
from gpiozero import LED from gpiozero import LED
from signal import pause from signal import pause
led = LED(2) led = LED(2)
led.on() led.on()
pause() pause()
```
Now running the program will stay running, leaving the LED on, until it is Now running the program will stay running, leaving the LED on, until it is
forced to quit. forced to quit.
@@ -77,13 +70,9 @@
Similarly, when setting up callbacks on button presses or other input Similarly, when setting up callbacks on button presses or other input
devices, the program needs to be running for the events to be detected: devices, the program needs to be running for the events to be detected:
```python
from gpiozero import Button from gpiozero import Button
from signal import pause from signal import pause
button = Button(2) button = Button(2)
button.when_pressed = lambda: print("Button was pressed!") button.when_pressed = lambda: print("Button was pressed!")
pause() pause()
```