Class: Denko::LED::Base

Inherits:
PulseIO::PWMOutput show all
Defined in:
lib/denko/led/base.rb

Constant Summary

Constants included from Behaviors::Lifecycle

Behaviors::Lifecycle::CALLBACK_METHODS

Constants included from Behaviors::OutputPin

Behaviors::OutputPin::OUTPUT_MODES

Instance Attribute Summary collapse

Attributes included from Behaviors::Threaded

#interrupts_enabled, #thread

Attributes included from Behaviors::State

#state

Attributes included from Behaviors::SinglePin

#mode, #pin

Attributes included from Behaviors::Component

#board, #params

Instance Method Summary collapse

Methods inherited from PulseIO::PWMOutput

#_frequency=, #_resolution=, #digital_write, #duty=, #frequency, #frequency=, #period, #pwm_disable, #pwm_enable, #pwm_enabled?, #pwm_high, #pwm_settings_hash, #pwm_write, #resolution, #resolution=

Methods included from Behaviors::Lifecycle

included

Methods inherited from DigitalIO::Output

#digital_write, #high, #high?, #low, #low?, #pre_callback_filter, #toggle

Methods included from Behaviors::Threaded

#enable_interrupts, included, #mruby_thread_check, #stop, #stop_thread, #threaded, #threaded_loop

Methods included from Behaviors::Callbacks

#add_callback, #callbacks, #pre_callback_filter, #remove_callback, #update

Methods included from Behaviors::State

#update_state

Methods included from Behaviors::SinglePin

#convert_pins, #initialize_pins

Methods included from Behaviors::Component

#initialize, #micro_delay

Instance Attribute Details

Returns the value of attribute blink_interval.



15
16
17
# File 'lib/denko/led/base.rb', line 15

def blink_interval
  @blink_interval
end

Instance Method Details



4
5
6
7
8
9
10
# File 'lib/denko/led/base.rb', line 4

def blink(interval=0.5)
  self.blink_interval = interval
  threaded_loop do
    toggle
    sleep @blink_interval
  end
end