from gpiozero import LED
from signal import pause
from random import randint


def set_source():
    while True:
        yield randint(0, 1)


led = LED(18)
led.source_delay = 1
led.source = set_source()
# led.source = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]

pause()
Exemplo n.º 2
0
from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause
import time

yellow_led = LED(4)
red_led = LED(17)
green_led = LED(18)

yellow_led.on()

time.sleep(15)

google = PingServer('google.com')

green_led.source_delay = 60
green_led.source = google

yellow_led.source = negated(green_led)

pause()
Exemplo n.º 3
0
#!/usr/bin/python3

from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause

green = LED(17)
red = LED(4)

google = PingServer('8.8.8.8')

green.source = google
green.source_delay = 60
red.source = negated(green)

pause()
Exemplo n.º 4
0
            print(f'Started state {r.state}')
            yield r.state == 'started'

    def build_passed():
        while True:
            r = travis.repo(repository_name)
            print(f'Passed state {r.state}')
            yield r.state == 'passed' and r.state != 'started'

    def build_unsuccessful():
        while True:
            r = travis.repo(repository_name)
            print(f'Unsuccessful state {r.state}')
            yield r.state != 'passed' and r.state != 'started'

    green.source = build_passed()
    green.source_delay = 20

    red.source = build_unsuccessful()
    red.source_delay = 20

    yellow.source = build_started()
    yellow.source_delay = 20

    pause()
except KeyboardInterrupt:
    green.off()
    red.off()
    yellow.off()
    print("Exiting...")
Exemplo n.º 5
0
from travispy import TravisPy
from gpiozero import LED
from gpiozero.tools import negated
from time import sleep
from signal import pause


def build_passed(repo):
    t = TravisPy()
    r = t.repo(repo)
    while True:
        yield r.last_build_state == 'passed'


red = LED(12)
green = LED(16)

green.source = build_passed('RPi-Distro/python-gpiozero')
green.source_delay = 60 * 5  # check every 5 minutes
red.source = negated(green.values)

pause()
Exemplo n.º 6
0
from travispy import TravisPy
from gpiozero import LED
from gpiozero.tools import negated
from time import sleep
from signal import pause

def build_passed(repo):
    t = TravisPy()
    r = t.repo(repo)
    while True:
        yield r.last_build_state == 'passed'

red = LED(12)
green = LED(16)

green.source = build_passed('RPi-Distro/python-gpiozero')
green.source_delay = 60 * 5  # check every 5 minutes
red.source = negated(green.values)

pause()
Exemplo n.º 7
0
from gpiozero import LEDBoard, LED
from gpiozero.tools import random_values
from signal import pause
import random
import datetime
from time import sleep

dayOfM = datetime.datetime.today().day

while True:
    if dayOfM <= 24:
        for x in random.sample(range(2, 28), dayOfM):
            #print(x)
            led = LED(x)
            led.on()
            sleep(2)
            led.off()
    else:
        tree = LEDBoard(*range(2, 28), pwm=True)

        for led in tree:
            led.source_delay = 0.1
            led.source = random_values()
        pause()
    sleep(5)
Exemplo n.º 8
0
from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause

green = LED(25)
red = LED(18)

google = PingServer('google.com')

green.source = google
green.source_delay = 1.5
red.source = negated(green)

pause()
from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause

green = LED(17)
red = LED(18)

google = PingServer('google.com')

green.source = google.values
green.source_delay = 60
red.source = negated(green.values)

pause()
Exemplo n.º 10
0
from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause

green = LED(19)
red = LED(26)

google = PingServer('google.com')

green.source = google
green.source_delay = 20
red.source = negated(green)

pause()from gpiozero import LED, PingServer
from gpiozero.tools import negated
from signal import pause

green = LED(19)
red = LED(26)

google = PingServer('google.com')

green.source = google
green.source_delay = 20
red.source = negated(green)

pause()