Ruby Gem for controlling L8 SmartLights (
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build Status


A Ruby Gem for communicating with an L8 SmartLight over USB.


Add this line to your application's Gemfile:

gem 'l8'

And then execute:

$ bundle

Or install it yourself as:

$ gem install l8


To connect to your L8 Smartlight, determine the serial port it's on and then create a new L8::Smartlight:

require 'l8'
l8 ='/dev/tty.usbmodem1421')

Change LEDs

Use set_led to set one of the LEDs to a color. The arguments are:

  • x coordinate of the LED (0..7)
  • y coordinate of the LED (0..7)
  • red color value (0..15)
  • green color value (0..15)
  • blue color values (0..15)

For example, to set the 5th LED in the 3rd row to orange:

l8.set_led(2, 4, 15, 7, 0)

Clear the LEDs

Use the clear_matrix method:


Change the Super (Back) LED

Use the set_superled method and pass 3 color values (0..15):

l8.set_superled(0, 0, 15)

Set L8 Brightness

You can control the overall brightness of the L8 using the set_brightness method with one of the following values: :high, :medium or :low.


Disable/Enable Status LEDs

The status LEDs on the top of the L8 can leak light into the LED matrix or just detract from the main LEDs in general, so you can turn them off with the disable_status_leds method. There is a enable_status_leds method to turn them back on.


Force L8 Orientation

If you lay the L8 flat or move it around a lot it may lose your preferred orienation in reference to the status lights at the top of the L8.

You can force the orientation using the set_orientation method and passing one of the following: :up, :down, :left or :right.


Display Character

To display an alpha-numeric character on the L8, use the display_character method and send a single Ascii character.


Power Off

You can turn the L8s off using the power_off method.


Controlling Groups of L8s

You can control a group of L8s as either a Stack or Row of them. This will give you a set_led method that treats them as one big matrix of LEDs.

stack ='/dev/tty.usbmodem1421', '/dev/tty.usbmodem1422')
stack.set_led(7, 15, 0, 15, 0)

The following methods are also available on groups of L8s and affect all L8s in the group.

  • clear_matrix
  • disable_status_lights

Identify L8s in a Group

When using a group of L8s you might get your USB ports/wires crossed and need to figure out the correct order to put the L8s in. The identify method will put a number on each L8 letting you know how to arrange them - left to right or top to bottom, start at 1.



  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request