mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Convert recipe examples to includes
Makes it much easier to test things - no copying'n'pasting just run the examples straight from the dir (after wiring stuff up)
This commit is contained in:
28
docs/examples/rgbled.py
Normal file
28
docs/examples/rgbled.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from gpiozero import RGBLED
|
||||
from time import sleep
|
||||
|
||||
led = RGBLED(red=9, green=10, blue=11)
|
||||
|
||||
led.red = 1 # full red
|
||||
sleep(1)
|
||||
led.red = 0.5 # half red
|
||||
sleep(1)
|
||||
|
||||
led.color = (0, 1, 0) # full green
|
||||
sleep(1)
|
||||
led.color = (1, 0, 1) # magenta
|
||||
sleep(1)
|
||||
led.color = (1, 1, 0) # yellow
|
||||
sleep(1)
|
||||
led.color = (0, 1, 1) # cyan
|
||||
sleep(1)
|
||||
led.color = (1, 1, 1) # white
|
||||
sleep(1)
|
||||
|
||||
led.color = (0, 0, 0) # off
|
||||
sleep(1)
|
||||
|
||||
# slowly increase intensity of blue
|
||||
for n in range(100):
|
||||
led.blue = n/100
|
||||
sleep(0.1)
|
||||
Reference in New Issue
Block a user