Class: Tinkerforge::BrickletRGBLEDButton
- Inherits:
-
Object
- Object
- Tinkerforge::BrickletRGBLEDButton
- Defined in:
- lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb
Instance Method Summary collapse
-
#blackout ⇒ Object
Switches off the button’s LED.
-
#rgb ⇒ Object
Returns the button’s current color as three values for red, green, and blue (integers in the range 0..255).
-
#rgb=(*rgb) ⇒ Object
Sets the button’s color using three values for red, green, and blue (integers in the range 0..255).
-
#state ⇒ Object
Returns the device’s state.
Instance Method Details
#blackout ⇒ Object
Switches off the button’s LED.
18 19 20 21 |
# 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 ⇒ Object
Returns the button’s current color as three values for red, green, and blue (integers in the range 0..255).
6 7 8 |
# File 'lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb', line 6 def rgb get_color end |
#rgb=(*rgb) ⇒ Object
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.
13 14 15 |
# File 'lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.rb', line 13 def rgb=(*rgb) set_color *rgb.flatten end |
#state ⇒ Object
Returns the device’s state.
24 25 26 27 28 29 30 |
# 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' => == 0, ) end |