Multiple RGBA LEDs can be chained together to create a string of colour-changing lights.

Chainable RGBA LED

Hardware

These LEDs (light-emitting diodes) have four control channels: Red, Green, Blue and Alpha (brightness). Multiple RGBA LEDs can be chained together by connecting one to one of the digital ports on the Grove shield:

Digital ports on the Grove shield v2.0

and then connecting several LEDS' "in" and "out" ports together.

Software

Functions that interact with the RGBA LEDs are prefixed with rgb_leds.

Colour manipulation

Any RGBA LED in the chain can be set to any colour, using either the HSV or RGB colour models.

def rgb_leds_colour_hsv(pin, count, led, hue, saturation, brightness):
    """"
    * Set the colours emitted by a specific RGB LED in the chain.
    *
    * @param    pin         digital pin to which chain is connected
    * @param    count       number of LEDs connected in chain
    * @param    led          which LED to change   @pre 0 <= led < count
    * @param    hue          colour  @pre 0 <= r <= 1.0
    * @param    saturation   how colourful the colour is  @pre 0 <= r <= 1.0
    * @param    brightness   overall brightness  @pre 0 <= r <= 1.0
    """"
def rgb_leds_colour_rgb(pin, count, led, red, green, blue):
    """"
    * Set the colours emitted by a specific RGB LED in the chain.
    *
    * @param    pin         digital pin to which chain is connected
    * @param    count       number of LEDs connected in chain
    * @param    led          which LED to change   @pre 0 <= led < count
    * @param    red          amount of red  @pre 0 <= r <= 255
    * @param    green        amount of green  @pre 0 <= r <= 255
    * @param    blue         amount of blue  @pre 0 <= r <= 255
    """"