From 9c64a1dc2f544ad93880ce963b5381ab0c780cb6 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Mon, 21 Sep 2015 12:04:51 +0100 Subject: [PATCH] Update the docs with an example Simple demo of when_dark / when_light --- docs/index.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/index.md b/docs/index.md index 26d8306..8ebf727 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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