Drivers

Artoo has a extensible system for connecting to hardware devices.

BlinkM


Allows user to control BlinkM RGB LED via i2c interface.

How To Connect

For Arduino:

require 'artoo'
connection :arduino, :adaptor => :firmata, :port => '/dev/ttyACM0'
device :blink_m, :driver => :blink_m, :connection => :arduino

How To Use

Example using a BlinkM.

require 'artoo'

connection :arduino, :adaptor => :firmata, :port => '/dev/ttyACM0'
device :blink_m, :driver => :blink_m

work do
  every 1.second do
    unless @on
      blink_m.rgb(0xff, 0xff, 0xff)
      @on = true
    else
      blink_m.rgb(0, 0, 0)
      @on = false
    end
  end
end

Commands

rgb(red=0, green=0, blue=0)

Sets the color of the BlinkM RGB LED to the specified combination of RGB color provided (red, green and blue values should be between 0 and 255).

Params
  • red - params, red value
  • green - params, green value
  • blue - params, blue
Returns

nil

fade(red=0, green=0, blue=0)

Fades the color of the BlinkM RGB LED to the specified combination of RGB color provided (red, green and blue values should be between 0 and 255).

Params
  • red - params, red value
  • green - params, green value
  • blue - params, blue
Returns

nil

firmware_version

Returns an sring describing the I2C firmware version being used.

Params

no params

Returns

String

color

Returns an array containing the RGB values for the current color (all integer between 0 and 255).

Params

no params

Returns

[red, green, blue] (integer)

Circuit

Compatibility