Class: BBB::Components::Led
- Inherits:
-
Object
- Object
- BBB::Components::Led
- Includes:
- Pinnable
- Defined in:
- lib/BBB/components/led.rb
Overview
The LED class is the component interface into a digital pin. In a way it’s nothing more than a straight forward port of a digital pin. You can use a led component when you want to use digital pins, or simply define your own class and extend it from the LED.
The Led class does not perform any sort of caching or smart calls, it forwards everything to the pin. In your own applications you might want to tune this behavior by adding some kind of caching.
Instance Attribute Summary
Attributes included from Pinnable
Instance Method Summary collapse
-
#off! ⇒ Object
Turns off the LED.
-
#off? ⇒ Boolean
Checks if the LED is turned off.
-
#on! ⇒ Object
Turns on the LED.
-
#on? ⇒ Boolean
Checks if the LED is turned on.
-
#pin ⇒ Object
Convenience method to grab the first pin in the pins array.
Methods included from Pinnable
#after_pin_initialization, included, #initialize_pins, #pinnable?, #verify_pin_position_count
Instance Method Details
#off! ⇒ Object
Turns off the LED
39 40 41 |
# File 'lib/BBB/components/led.rb', line 39 def off! pin.off! end |
#off? ⇒ Boolean
Checks if the LED is turned off.
57 58 59 |
# File 'lib/BBB/components/led.rb', line 57 def off? pin.off? end |
#on! ⇒ Object
Turns on the LED
31 32 33 |
# File 'lib/BBB/components/led.rb', line 31 def on! pin.on! end |
#on? ⇒ Boolean
Checks if the LED is turned on.
48 49 50 |
# File 'lib/BBB/components/led.rb', line 48 def on? pin.on? end |
#pin ⇒ Object
Convenience method to grab the first pin in the pins array
23 24 25 |
# File 'lib/BBB/components/led.rb', line 23 def pin pins.first end |