Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def on_start(self):
self.LED = gpiozero.PWMLED(self.settings.pin)
from gpiozero import LightSensor, PWMLED
from signal import pause
sensor = LightSensor(18)
led = PWMLED(16)
led.source = sensor
pause()
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()
from gpiozero import PWMLED, MCP3008
from signal import pause
led = PWMLED(17)
pot = MCP3008()
led.source = pot
pause()
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
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()
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,
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"
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()