Class: PiLightsControl::Command
- Inherits:
-
Object
- Object
- PiLightsControl::Command
- Defined in:
- lib/pi-lights-control/command.rb
Instance Attribute Summary collapse
-
#repeat_count ⇒ Object
Returns the value of attribute repeat_count.
Instance Method Summary collapse
-
#initialize(pin, options = {}) ⇒ Command
constructor
A new instance of Command.
- #power_off ⇒ Object
- #power_on ⇒ Object
- #program(name) ⇒ Object
- #sync_lights ⇒ Object
Constructor Details
#initialize(pin, options = {}) ⇒ Command
Returns a new instance of Command.
5 6 7 8 9 |
# File 'lib/pi-lights-control/command.rb', line 5 def initialize(pin, = {}) RPi::GPIO.set_numbering([:numbering] || :board) @repeat_count = 6 @pin = pin end |
Instance Attribute Details
#repeat_count ⇒ Object
Returns the value of attribute repeat_count.
3 4 5 |
# File 'lib/pi-lights-control/command.rb', line 3 def repeat_count @repeat_count end |
Instance Method Details
#power_off ⇒ Object
11 12 13 |
# File 'lib/pi-lights-control/command.rb', line 11 def power_off transmit_command(PiLightsControl::COMMAND_TABLE[:power_off]) end |
#power_on ⇒ Object
15 16 17 |
# File 'lib/pi-lights-control/command.rb', line 15 def power_on transmit_command(PiLightsControl::COMMAND_TABLE[:power_on]) end |
#program(name) ⇒ Object
19 20 21 22 |
# File 'lib/pi-lights-control/command.rb', line 19 def program(name) program_name = "program_#{name.to_s}" transmit_command(PiLightsControl::COMMAND_TABLE[program_name.to_sym]) end |
#sync_lights ⇒ Object
24 25 26 |
# File 'lib/pi-lights-control/command.rb', line 24 def sync_lights transmit_command(PiLightsControl::COMMAND_TABLE[:sync_lights]) end |