Class: Tinkerforge::BrickletColorV2
- Inherits:
-
Object
- Object
- Tinkerforge::BrickletColorV2
- Defined in:
- lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.rb
Constant Summary collapse
- GAINS =
[1, 4, 16, 60]
- INTEGRATION_TIMES =
[2.4, 24, 101, 154, 700]
Instance Method Summary collapse
-
#blackout ⇒ Object
Switches off the Bricklet’s white LED.
-
#state ⇒ Object
Returns the device’s state.
Instance Method Details
#blackout ⇒ Object
Switches off the Bricklet’s white LED.
9 10 11 12 |
# File 'lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.rb', line 9 def blackout set_light false true end |
#state ⇒ Object
Returns the device’s state.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.rb', line 15 def state super.merge( 'configuration' => config = get_configuration, 'gain' => GAINS[ config[0] ], 'integration_time' => INTEGRATION_TIMES[ config[1] ], 'color_rgbc' => color = get_color, 'illuminance_raw' => illum = get_illuminance, 'illuminance' => illum * 700.0 / GAINS[ config[0] ] / INTEGRATION_TIMES[ config[1] ], 'color_temperature' => get_color_temperature, 'saturated' => color[0,3].include?(65535), 'light' => get_light, ) end |