mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2026-04-24 16:03:50 +00:00
Add Pi Zero OTG, sense hat examples and more docs
This commit is contained in:
9
docs/examples/pi_zero_remote.py
Normal file
9
docs/examples/pi_zero_remote.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from gpiozero import LED
|
||||
from gpiozero.pins.pigpio import PiGPIOPin
|
||||
from signal import pause
|
||||
|
||||
led = LED(PiGPIOPin(17, host='raspberrypi.local'))
|
||||
|
||||
led.blink()
|
||||
|
||||
pause()
|
||||
10
docs/examples/sense_hat_remote.py
Normal file
10
docs/examples/sense_hat_remote.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from gpiozero import MotionSensor
|
||||
from gpiozero.pins.pigpio import PiGPIOPin
|
||||
from sense_hat import SenseHat
|
||||
|
||||
pir = MotionSensor(PiGPIOPin(4, host='192.168.1.4')) # remote motion sensor
|
||||
sense = SenseHat() # local sense hat
|
||||
|
||||
while True:
|
||||
pir.wait_for_motion()
|
||||
sense.show_message(sense.temperature)
|
||||
15
docs/examples/sense_hat_remote_2.py
Normal file
15
docs/examples/sense_hat_remote_2.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from gpiozero import LightSensor
|
||||
from gpiozero.pins.pigpio import PiGPIOPin
|
||||
from sense_hat import SenseHat
|
||||
|
||||
light = LightSensor(PiGPIOPin(4, host='192.168.1.4')) # remote motion sensor
|
||||
sense = SenseHat() # local sense hat
|
||||
|
||||
blue = (0, 0, 255)
|
||||
yellow = (255, 255, 0)
|
||||
|
||||
while True:
|
||||
if light.value > 0.5:
|
||||
sense.clear(yellow)
|
||||
else:
|
||||
sense.clear(blue)
|
||||
Reference in New Issue
Block a user