A collection of examples for using the gpiozero library for reading sensors and activating actuators
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import sys
|
|
|
|
from gpiozero import PWMLED
|
|
|
|
from gpiozero.pins.pigpio import PiGPIOFactory
|
|
|
|
from signal import pause
|
|
|
|
from time import sleep
|
|
|
|
from gpiozero.tools import all_values
|
|
|
|
|
|
|
|
#This code is meant to be run FROM a Pi connected to the interaction.tools network
|
|
|
|
#It allows you to read/write Pins from other PIs on the network
|
|
|
|
|
|
|
|
bobPi = PiGPIOFactory(host='10.10.10.25')
|
|
|
|
alicePi = PiGPIOFactory(host='10.10.10.26')
|
|
|
|
|
|
|
|
led = LED(17)
|
|
|
|
|
|
|
|
button_bob = Button(18, pin_factory=bobPi)
|
|
|
|
button_alice = Button(18, pin_factory=alicePi)
|
|
|
|
|
|
|
|
led.source = all_values(button_alice, button_bob)
|
|
|
|
|
|
|
|
pause()
|
|
|
|
|