Class: Ledstrip::Strip
- Inherits:
-
Object
- Object
- Ledstrip::Strip
- Defined in:
- lib/ledstrip/strip.rb
Instance Attribute Summary collapse
-
#effect ⇒ Object
Returns the value of attribute effect.
-
#leds ⇒ Object
Returns the value of attribute leds.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(led_count, type:) ⇒ Strip
constructor
A new instance of Strip.
- #set_effect(name, options = {}) ⇒ Object
- #sleep_time ⇒ Object
Constructor Details
#initialize(led_count, type:) ⇒ Strip
Returns a new instance of Strip.
6 7 8 9 10 11 |
# File 'lib/ledstrip/strip.rb', line 6 def initialize(led_count, type:) @leds = [] @type = type init_leds(led_count) end |
Instance Attribute Details
#effect ⇒ Object
Returns the value of attribute effect.
4 5 6 |
# File 'lib/ledstrip/strip.rb', line 4 def effect @effect end |
#leds ⇒ Object
Returns the value of attribute leds.
4 5 6 |
# File 'lib/ledstrip/strip.rb', line 4 def leds @leds end |
Instance Method Details
#draw ⇒ Object
19 20 21 |
# File 'lib/ledstrip/strip.rb', line 19 def draw @type.draw(@leds) end |
#set_effect(name, options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/ledstrip/strip.rb', line 13 def set_effect(name, ={}) @effect.stop if @effect @effect = Ledstrip::Effects.instantiate(self, name, ) @effect.start end |
#sleep_time ⇒ Object
23 24 25 |
# File 'lib/ledstrip/strip.rb', line 23 def sleep_time @effect.sleep_time end |