#!/usr/bin/env python # Import the library functions we need import time import wiringpi2 as wiringpi wiringpi.wiringPiSetup() # Setup the LedBorg GPIO pins PIN_RED = 0 PIN_GREEN = 2 PIN_BLUE = 3 wiringpi.pinMode(PIN_RED, wiringpi.GPIO.OUTPUT) wiringpi.pinMode(PIN_GREEN, wiringpi.GPIO.OUTPUT) wiringpi.pinMode(PIN_BLUE, wiringpi.GPIO.OUTPUT) # A function to set the LedBorg colours def SetLedBorg(red, green, blue): wiringpi.digitalWrite(PIN_RED, red) wiringpi.digitalWrite(PIN_GREEN, green) wiringpi.digitalWrite(PIN_BLUE, blue) # A function to turn the LedBorg off def LedBorgOff(): SetLedBorg(0, 0, 0) # Settings for the sequence delay = 2 # Set the LedBorg to red SetLedBorg(1, 0, 0) print 'Red' time.sleep(delay) # Set the LedBorg to green SetLedBorg(0, 1, 0) print 'Green' time.sleep(delay) # Set the LedBorg to blue SetLedBorg(0, 0, 1) print 'Blue' time.sleep(delay) # Set the LedBorg to yellow SetLedBorg(1, 1, 0) print 'Yellow' time.sleep(delay) # Set the LedBorg to cyan SetLedBorg(0, 1, 1) print 'Cyan' time.sleep(delay) # Set the LedBorg to magenta SetLedBorg(1, 0, 1) print 'Magenta' time.sleep(delay) # Set the LedBorg to white SetLedBorg(1, 1, 1) print 'White' time.sleep(delay) # Turn the LedBorg off LedBorgOff() print 'LedBorg off'