Beispiel #1
0
##These match GPIO board pins used by LED board.
red_pin = 19 
green_pin = 21 
blue_pin = 23
run = True #If True, main light and refresh data loop will run.

##Scale for RGB intensity combinations to give the correct
##temperature/colour scale.
temp_scale = [
                [-30,-17, -0, 12, 20, 26, 35, 50], #degress C
                [  0,  0,  0,100,255,255,255,255], #Red
                [183, 65, 94,100,224,140, 55,  0], #Green
                [  0,178,255,100,  0,  0,  0,197], #Blue
             ]
##Initialise light object with correct board pins
globe = ll.light(red_pin, green_pin, blue_pin)

##Check forecase time
if args.foretime < 0 or args.foretime > 12:
    args.foretime = 2 #set to sensible default
    print("Forecast period out of range (1-12 hours). Set to 2 hours.")
    globe.colour(255,0,255,1) #flash magenta to tell user.

##check refresh interval. We don't need to check too often, the forecast
##isn't refreshed that quickly.
if args.refresh < 5 or args.refresh > 60:
    args.refresh = 15 #set to sensible default
    print("Refresh time out of range (10-60 minutes). Set to 15 minutes.")
    globe.colour(0,255,255,1) #flash cyan to tell user.
    
##Can we connect to our website?
Beispiel #2
0
#!/usr/bin/python3
"""
globetest.py Version 1.0
To test if the LEDs light up correctly using the LED board and lampi_lib.
"""

import lampi_lib as ll
import RPi.GPIO as GPIO

##pin numbers to match LED legs
##These match LED board pins.
red_pin = 19 
green_pin = 21 
blue_pin = 23

##create a light object with correct board pins
lamp = ll.light(red_pin, green_pin, blue_pin)

##Run the seven colour test pattern.
lamp.testcycle()

##Let's close all the GPIO connections correctly for our light object.
lamp.shutdown()

##Last we need to close all GPIO connections properly.
GPIO.cleanup()