How to use the gpiozero.pins.pigpio.PiGPIOFactory function in gpiozero

To help you get started, we’ve selected a few gpiozero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tinue / apa102-pi / driver / apa102.py View on Github external
"""
        self.num_led = num_led  # The number of LEDs in the Strip
        order = order.lower()
        self.rgb = RGB_MAP.get(order, RGB_MAP['rgb'])
        # Limit the brightness to the maximum if it's set higher
        if global_brightness > self.MAX_BRIGHTNESS:
            self.global_brightness = self.MAX_BRIGHTNESS
        else:
            self.global_brightness = global_brightness

        self.leds = [self.LED_START,0,0,0] * self.num_led #Pixel buffer
        self.start_frame = [0] * 4 #32 bits of zeroes
        self.end_frame = [0] * ((self.num_led + 15) // 8) #num_led/2 bits, rounded up to the next byte

        factory = PiGPIOFactory(host='localhost')
        self.spi=factory.spi(mosi_pin=mosi, clock_pin=sclk)
github home-assistant / home-assistant / homeassistant / components / remote_rpi_gpio / __init__.py View on Github external
def setup_output(address, port, invert_logic):
    """Set up a GPIO as output."""

    try:
        return LED(port, active_high=invert_logic, pin_factory=PiGPIOFactory(address))
    except (ValueError, IndexError, KeyError):
        return None
github gpiozero / gpiozero / docs / examples / led_button_remote_2.py View on Github external
from gpiozero import LED
from gpiozero.pins.pigpio import PiGPIOFactory
from gpiozero.tools import all_values
from signal import pause

factory3 = PiGPIOFactory(host='192.168.1.3')
factory4 = PiGPIOFactory(host='192.168.1.4')

led = LED(17)
button_1 = Button(17, pin_factory=factory3)
button_2 = Button(17, pin_factory=factory4)

led.source = all_values(button_1, button_2)

pause()
github tenstone / kim-voice-assistant / utils / respi_gpio / remote.py View on Github external
def __init__(self, ip_address):
        pigpio.pi()
        self.factory = PiGPIOFactory(host=ip_address, port=8888)
        pass
github gpiozero / gpiozero / docs / examples / pi_zero_remote.py View on Github external
from gpiozero import LED
from gpiozero.pins.pigpio import PiGPIOFactory
from signal import pause

factory = PiGPIOFactory(host='raspberrypi.local')
led = LED(17, pin_factory=factory)

led.blink()

pause()
github gpiozero / gpiozero / docs / examples / led_remote_3.py View on Github external
from gpiozero import LED
from gpiozero.pins.pigpio import PiGPIOFactory
from time import sleep

remote_factory = PiGPIOFactory(host='192.168.1.3')
led_1 = LED(17)  # local pin
led_2 = LED(17, pin_factory=remote_factory)  # remote pin

while True:
    led_1.on()
    led_2.off()
    sleep(1)
    led_1.off()
    led_2.on()
    sleep(1)
github gpiozero / gpiozero / docs / examples / multi_room_doorbell.py View on Github external
from gpiozero import LEDBoard, MotionSensor
from gpiozero.pins.pigpio import PiGPIOFactory
from signal import pause

ips = ['192.168.1.3', '192.168.1.4', '192.168.1.5', '192.168.1.6']
remotes = [PiGPIOFactory(host=ip) for ip in ips]

button = Button(17)  # button on this pi
buzzers = [Buzzer(pin, pin_factory=r) for r in remotes]  # buzzers on remote pins

for buzzer in buzzers:
    buzzer.source = button

pause()
github gpiozero / gpiozero / docs / examples / led_remote_5.py View on Github external
from gpiozero import LED
from gpiozero.pins.pigpio import PiGPIOFactory
from time import sleep

factory3 = PiGPIOFactory(host='192.168.1.3')
factory4 = PiGPIOFactory(host='192.168.1.4')

led_1 = LED(17)  # local pin
led_2 = LED(17, pin_factory=factory3)  # remote pin on one pi
led_3 = LED(17, pin_factory=factory4)  # remote pin on another pi

while True:
    led_1.on()
    led_2.off()
    led_3.on()
    sleep(1)
    led_1.off()
    led_2.on()
    led_3.off()
    sleep(1)
github gpiozero / gpiozero / docs / examples / traffichat_remote_2.py View on Github external
import gpiozero
from gpiozero import TrafficHat
from gpiozero.pins.pigpio import PiGPIOFactory
from time import sleep

remote_factory = PiGPIOFactory(host='192.168.1.3')

th_1 = TrafficHat()  # traffic hat using local pins
th_2 = TrafficHat(pin_factory=remote_factory)  # traffic hat on 192.168.1.3 using remote pins
github gpiozero / gpiozero / docs / examples / led_remote_1.py View on Github external
from gpiozero import LED
from gpiozero.pins.pigpio import PiGPIOFactory
from time import sleep

factory = PiGPIOFactory(host='192.168.1.3')
led = LED(17, pin_factory=factory)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)