Class: LED
- Inherits:
-
BinaryEffector
- Object
- Effector
- DigitalEffector
- BinaryEffector
- LED
- Defined in:
- lib/led.rb,
lib/led.rb,
lib/led_pwm.rb,
lib/led_rgb.rb
Overview
Experimental methods with names in Russian
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
-
#blink(repeat = 3, switched_on = 0.25, switched_off = 0.5) ⇒ Object
Repeat ‘repeat’ times: light the LED for ‘switched_on’ secs, then pause for ‘switched_off’ secs.
-
#initialize(pin) ⇒ LED
constructor
A new instance of LED.
- #off(pin = @pin) ⇒ Object
- #off_for(seconds = 1) ⇒ Object
- #on(pin = @pin) ⇒ Object
- #on_for(seconds = 1) ⇒ Object
- #включить ⇒ Object
- #выключить ⇒ Object
- #мигать(repeat = 3, switched_on = 0.25, switched_off = 0.5) ⇒ Object
Methods inherited from DigitalEffector
Methods inherited from Effector
Constructor Details
#initialize(pin) ⇒ LED
Returns a new instance of LED.
5 6 7 8 |
# File 'lib/led.rb', line 5 def initialize(pin) super(pin) self.name = 'LED' end |
Class Method Details
Instance Method Details
#blink(repeat = 3, switched_on = 0.25, switched_off = 0.5) ⇒ Object
Repeat ‘repeat’ times: light the LED for ‘switched_on’ secs, then pause for ‘switched_off’ secs
19 20 21 22 23 24 25 26 |
# File 'lib/led.rb', line 19 def blink(repeat=3, switched_on=0.25, switched_off=0.5) repeat.times do |n| on sleep switched_on off sleep switched_off end end |
#off(pin = @pin) ⇒ Object
14 15 16 |
# File 'lib/led.rb', line 14 def off(pin=@pin) super(pin) end |
#off_for(seconds = 1) ⇒ Object
34 35 36 37 38 |
# File 'lib/led.rb', line 34 def off_for(seconds=1) off sleep seconds on end |
#on(pin = @pin) ⇒ Object
10 11 12 |
# File 'lib/led.rb', line 10 def on(pin=@pin) super(pin) end |
#on_for(seconds = 1) ⇒ Object
28 29 30 31 32 |
# File 'lib/led.rb', line 28 def on_for(seconds=1) on sleep seconds off end |
#включить ⇒ Object
47 48 49 |
# File 'lib/led.rb', line 47 def включить on end |
#выключить ⇒ Object
51 52 53 |
# File 'lib/led.rb', line 51 def выключить off end |
#мигать(repeat = 3, switched_on = 0.25, switched_off = 0.5) ⇒ Object
55 56 57 |
# File 'lib/led.rb', line 55 def мигать(repeat=3, switched_on=0.25, switched_off=0.5) blink(repeat, switched_on, switched_off) end |