Update the docs with an example

Simple demo of when_dark / when_light
This commit is contained in:
Dave Jones
2015-09-21 12:04:51 +01:00
parent e9a970ae5c
commit 9c64a1dc2f

View File

@@ -154,13 +154,17 @@ while True:
Retrieve light sensor value:
```python
from time import sleep
from gpiozero import LightSensor
light = LightSensor(6)
sensor = LightSensor(18)
led = LED(16)
sensor.when_dark = led.on
sensor.when_light = led.off
while True:
if light.light_detected:
print("Light detected")
sleep(1)
```
### Temperature Sensor