class Tinkerforge::BrickletRGBLEDButton

Public Instance Methods

blackout() click to toggle source

Switches off the button's LED.

# File lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb, line 18
def blackout
  self.rgb = 0, 0, 0
  true
end
rgb() click to toggle source

Returns the button's current color as three values for red, green, and blue (integers in the range 0..255).

# File lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb, line 6
def rgb
  get_color
end
rgb=(*rgb) click to toggle source

Sets the button's color using three values for red, green, and blue (integers in the range 0..255).

Values can be supplied as an array or as three separate values.

# File lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb, line 13
def rgb=(*rgb)
  set_color *rgb.flatten
end
state() click to toggle source

Returns the device's state.

Calls superclass method
# File lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb, line 24
def state
  super.merge(
    'color_rgb'         => get_color,
    'color_calibration' => get_color_calibration,
    'pressed'           => get_button_state == 0,
  )
end