Ejemplo n.º 1
0
        idleHSI = temp['hsi']
    elif t == topics[0][0]:
        global mainLight         # needed to merge data into stream
        mainLight = isON(msg)    # save new light command
    
client.on_message = on_message

light = DigitalOutputDevice(4)  # define GPIO pin for control relay
strip = RGBLED(13, 6, 5)        # define GPIO pins for led strip
strip_color = HSI_LED()

connected = hollaBroker()       # is broker found
while connected:
    try:
        sec = time.monotonic()
        if (int(sec) % 2 == 0):
            client.loop_start()
            isListening = True
            offTime = sec + 1.5
        elif (sec >= offTime and isListening): 
            client.loop_stop()
        strip_color.tick()
        strip.value = (strip_color.rgb[0], strip_color.rgb[1],strip_color.rgb[2])
        light.value = mainLight
    except KeyboardInterrupt:
        client.disconnect()
        client.loop_stop()
        break
    #time.sleep(0.5)
#end client connected loop
Ejemplo n.º 2
0
import rtde_io
import rtde_receive
import time
from gpiozero import RGBLED

rtde_receive_ = rtde_receive.RTDEReceiveInterface("192.168.2.66")

led = RGBLED(23, 24, 25)

while True:
    try:
        if rtde_receive_.getDigitalOutState(0):
            led.value = (0,1,0)
        else:
            led.value = (0,0,0)
        time.sleep(0.1)
    except:
        break

Ejemplo n.º 3
0
from signal import pause
from time import sleep

from gpiozero import RGBLED

l = RGBLED(17, 27, 22)

while True:
    l.value = (1, 1, 1)
    sleep(1)
    l.value = (1, 0, 0)
    sleep(1)
    l.value = (0, 1, 0)
    sleep(1)
    l.value = (0, 0, 1)
    sleep(1)
    l.value = (1, 1, 0)
    sleep(1)
    l.value = (0, 1, 1)
    sleep(1)