Example #1
0
def main():
    # Setup the Rasp.IO LED Strings
    ledstrip = apa.Apa(led_config.numleds)  # initiate an LED strip
    ledstrip.zero_leds()
    ledstrip.write_leds()

    clock = ClockRing(ledstrip)
    clock.start()

    # Set up the handler class
    handlerclass = Temperature(ledstrip)
    # Start MQTT Listener
    Messages.MQTTMessages(config.mqttconfig, handlerclass)

    handlerclass.start()

    pause()
Example #2
0
import time  # This clock works with RasPiO InsPiRing Circle
from time import sleep  # http://rasp.io/inspiring
from datetime import datetime
import apa  # RasPiO InsPiRing driver class
numleds = 24  # number of LEDs in our display
brightness = 6  # 0-31, 224-255 or 0xE0-0xFF
ledstrip = apa.Apa(numleds)  # initiate an LED strip


def wipe(brightness, b, g, r):  # function for hourly etc. wipe animations
    for i in range(numleds):
        ledstrip.led_set(i, brightness, b, g, r)
        ledstrip.write_leds()
        sleep(0.03)
    sleep(0.25)
    ledstrip.zero_leds()
    ledstrip.write_leds()


print('Press Ctrl-C to quit.')

try:
    while True:
        timenow = datetime.now()  # grab local time from the Pi
        hour = timenow.hour  # and process into hour min sec
        if hour >= 12:
            hour = hour - 12
        minute = timenow.minute
        second = float(timenow.second + timenow.microsecond / 1000000)
        print(hour, minute, "{0:.3f}".format(second))
Example #3
0
from time import sleep      # RasPiO Inspiring scripts
import apa                  # http://rasp.io/inspiring
numleds = 24                # number of LEDs in our display
brightness = 11             # 0 = OFF, 31 = FULL
ledstrip = apa.Apa(numleds)

try:
    while True:
        for x in range(numleds):
            ledstrip.led_set(x, brightness, 0, 0, 255)  # red
        ledstrip.write_leds()
        sleep(1)
        for x in range(numleds):
            ledstrip.led_set(x, brightness, 0, 255, 0)  # green
        ledstrip.write_leds()
        sleep(1)
        for x in range(numleds):
            ledstrip.led_set(x, brightness, 255, 0, 0)  # blue
        ledstrip.write_leds()
        sleep(1)

finally:
    print("/nAll LEDs OFF - BYE!/n")
    ledstrip.zero_leds()
    ledstrip.write_leds()
Example #4
0
import apa                          # import apa module
ledstrip = apa.Apa(24)              # set up 24 LEDs
ledstrip.led_set(3, 31, 0, 255, 0)  # set LED 3 value to full green
ledstrip.write_leds()               # send values to all LEDs

# RasPiO Inspiring scripts
# http://rasp.io/inspiring
Example #5
0
 def __init__(self):
     self.__led_arrows = apa.Apa(24)
     self.__led_arrows.flush_leds()
     self.__led_arrows.zero_leds()
     self.__led_arrows.write_leds()