Class: Denko::LED::RGB
Constant Summary
collapse
- COLORS =
{
red: [255, 000, 000],
green: [000, 255, 000],
blue: [000, 000, 255],
cyan: [000, 255, 255],
yellow: [255, 255, 000],
magenta: [255, 000, 255],
white: [255, 255, 255],
off: [000, 000, 000]
}
Instance Attribute Summary
#pin, #pins, #proxies
#board
Instance Method Summary
collapse
#before_initialize, #convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
#initialize, #micro_delay
#initialize, #state
Instance Method Details
#color=(color) ⇒ Object
30
31
32
33
34
35
|
# File 'lib/denko/led/rgb.rb', line 30
def color=(color)
return write(color) if color.class == Array
color = color.to_sym
write(COLORS[color]) if COLORS.include? color
end
|
#initialize_pins(options = {}) ⇒ Object
6
7
8
9
10
|
# File 'lib/denko/led/rgb.rb', line 6
def initialize_pins(options={})
proxy_pin :red, LED::Base
proxy_pin :green, LED::Base
proxy_pin :blue, LED::Base
end
|
#write(array) ⇒ Object
24
25
26
27
28
|
# File 'lib/denko/led/rgb.rb', line 24
def write(array)
red.write array[0]
green.write array[1]
blue.write array[2]
end
|