How to use the gpiozero.PWMLED 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 opensight-cv / opensight / opsi / modules / gpio.py View on Github external
def on_start(self):
        self.LED = gpiozero.PWMLED(self.settings.pin)
github gpiozero / gpiozero / docs / examples / light_sensor_3.py View on Github external
from gpiozero import LightSensor, PWMLED
from signal import pause

sensor = LightSensor(18)
led = PWMLED(16)

led.source = sensor

pause()
github danclarke / WorkingStargateMk2Raspi / LightingControl.py View on Github external
import config
from gpiozero import PWMLED
from time import sleep


class LightingControl:
    chevrons = [PWMLED(pin, frequency=10000) for pin in config.pins_chevron]
    gantry = PWMLED(config.pin_gantry, frequency=10000)

    # Constructor
    def __init__(self):
        # Ensure LEDs are all initially off
        for chevron in self.chevrons:
            chevron.off()
        self.gantry.off()

    # Cycle through each chevron in turn with a delay between each
    def cycle_chevrons(self):
        for led_num, chevron in enumerate(self.chevrons):
            print('LED: {}'.format(led_num + 1))
            chevron.on()
            sleep(5)
            chevron.off()
github gpiozero / gpiozero / docs / examples / pwmled_pot.py View on Github external
from gpiozero import PWMLED, MCP3008
from signal import pause

led = PWMLED(17)
pot = MCP3008()

led.source = pot

pause()
github aws-samples / aws-greengrass-mini-fulfillment / groups / master / ggd / button.py View on Github external
dir_path = os.path.dirname(os.path.realpath(__file__))

log = logging.getLogger('button')
handler = logging.StreamHandler()
formatter = logging.Formatter(
    '%(asctime)s|%(name)-8s|%(levelname)s: %(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
log.setLevel(logging.INFO)

GGD_BUTTON_TOPIC = "button"

hostname = socket.gethostname()
green_led = PWMLED(4)
green_button = Button(5)
red_led = PWMLED(17)
red_button = Button(6)
white_led = PWMLED(27)
white_button = Button(13)
mqttc = None
ggd_name = None


def button(sensor_id, toggle):
    now = datetime.datetime.now()
    if toggle:
        val = "on"
    else:
        val = "off"

    msg = {
        "version": "2017-07-05",  # YYYY-MM-DD
github martinohanlon / BlueDot / examples / slider_led_dimmer.py View on Github external
from bluedot import BlueDot
from gpiozero import PWMLED
from signal import pause

def set_brightness(pos):
    brightness = ((pos.y + 1) / 2)
    led.value = brightness

bd = BlueDot()
bd.when_moved = set_brightness
led = PWMLED(17)

pause()
github aws-samples / aws-greengrass-mini-fulfillment / groups / master / ggd / button.py View on Github external
log = logging.getLogger('button')
handler = logging.StreamHandler()
formatter = logging.Formatter(
    '%(asctime)s|%(name)-8s|%(levelname)s: %(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
log.setLevel(logging.INFO)

GGD_BUTTON_TOPIC = "button"

hostname = socket.gethostname()
green_led = PWMLED(4)
green_button = Button(5)
red_led = PWMLED(17)
red_button = Button(6)
white_led = PWMLED(27)
white_button = Button(13)
mqttc = None
ggd_name = None


def button(sensor_id, toggle):
    now = datetime.datetime.now()
    if toggle:
        val = "on"
    else:
        val = "off"

    msg = {
        "version": "2017-07-05",  # YYYY-MM-DD
        "ggd_id": ggd_name,
        "hostname": hostname,
github aws-samples / aws-greengrass-mini-fulfillment / groups / master / ggd / button.py View on Github external
from gg_group_setup import GroupConfigFile

dir_path = os.path.dirname(os.path.realpath(__file__))

log = logging.getLogger('button')
handler = logging.StreamHandler()
formatter = logging.Formatter(
    '%(asctime)s|%(name)-8s|%(levelname)s: %(message)s')
handler.setFormatter(formatter)
log.addHandler(handler)
log.setLevel(logging.INFO)

GGD_BUTTON_TOPIC = "button"

hostname = socket.gethostname()
green_led = PWMLED(4)
green_button = Button(5)
red_led = PWMLED(17)
red_button = Button(6)
white_led = PWMLED(27)
white_button = Button(13)
mqttc = None
ggd_name = None


def button(sensor_id, toggle):
    now = datetime.datetime.now()
    if toggle:
        val = "on"
    else:
        val = "off"
github danclarke / WorkingStargateMk2Raspi / LightingControl.py View on Github external
import config
from gpiozero import PWMLED
from time import sleep


class LightingControl:
    chevrons = [PWMLED(pin, frequency=10000) for pin in config.pins_chevron]
    gantry = PWMLED(config.pin_gantry, frequency=10000)

    # Constructor
    def __init__(self):
        # Ensure LEDs are all initially off
        for chevron in self.chevrons:
            chevron.off()
        self.gantry.off()

    # Cycle through each chevron in turn with a delay between each
    def cycle_chevrons(self):
        for led_num, chevron in enumerate(self.chevrons):
            print('LED: {}'.format(led_num + 1))
            chevron.on()
            sleep(5)
            chevron.off()