Class: Pinoccio::LedCommands
- Inherits:
-
CommandCollection
- Object
- CommandCollection
- Pinoccio::LedCommands
- Defined in:
- lib/commands.rb
Instance Method Summary collapse
- #blink(r, g, b, ms = nil, continuous = nil) ⇒ Object
- #blue ⇒ Object
- #cyan ⇒ Object
- #green ⇒ Object
- #hex=(value) ⇒ Object
- #magenta ⇒ Object
- #off ⇒ Object
- #orange ⇒ Object
- #purple ⇒ Object
- #red ⇒ Object
- #report ⇒ Object
- #rgb=(r, g, b) ⇒ Object
- #torch ⇒ Object
- #torch=(r, g, b) ⇒ Object
- #white ⇒ Object
- #yellow ⇒ Object
Methods inherited from CommandCollection
#execute, #get, #initialize, #run
Constructor Details
This class inherits a constructor from Pinoccio::CommandCollection
Instance Method Details
#blink(r, g, b, ms = nil, continuous = nil) ⇒ Object
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/commands.rb', line 112 def blink(r, g, b, ms=nil, continuous=nil) if ms.nil? execute("led.blink(#{r}, #{g}, #{b})") elsif continuous.nil? execute("led.blink(#{r}, #{g}, #{b}, #{ms})") else continuous = (continuous == 1) execute("led.blink(#{r}, #{g}, #{b}, #{ms}, #{continuous})") end end |
#blue ⇒ Object
126 |
# File 'lib/commands.rb', line 126 def blue; execute("led.blue"); end |
#cyan ⇒ Object
127 |
# File 'lib/commands.rb', line 127 def cyan; execute("led.cyan"); end |
#green ⇒ Object
125 |
# File 'lib/commands.rb', line 125 def green; execute("led.green"); end |
#hex=(value) ⇒ Object
135 136 137 |
# File 'lib/commands.rb', line 135 def hex=(value) execute(%[led.sethex("#{value}")]) end |
#magenta ⇒ Object
129 |
# File 'lib/commands.rb', line 129 def magenta; execute("led.magenta"); end |
#off ⇒ Object
123 |
# File 'lib/commands.rb', line 123 def off; execute("led.off"); end |
#orange ⇒ Object
131 |
# File 'lib/commands.rb', line 131 def orange; execute("led.orange"); end |
#purple ⇒ Object
128 |
# File 'lib/commands.rb', line 128 def purple; execute("led.purple"); end |
#red ⇒ Object
124 |
# File 'lib/commands.rb', line 124 def red; execute("led.red"); end |
#report ⇒ Object
147 148 149 |
# File 'lib/commands.rb', line 147 def report run("led.report", :json) end |
#rgb=(r, g, b) ⇒ Object
139 140 141 |
# File 'lib/commands.rb', line 139 def rgb=(r, g, b) execute(%[led.setrgb(#{r}, #{g}, #{b})]) end |
#torch ⇒ Object
133 |
# File 'lib/commands.rb', line 133 def torch; execute("led.torch"); end |
#torch=(r, g, b) ⇒ Object
143 144 145 |
# File 'lib/commands.rb', line 143 def torch=(r, g, b) execute(%[led.savetorch(#{r}, #{g}, #{b})]) end |
#white ⇒ Object
132 |
# File 'lib/commands.rb', line 132 def white; execute("led.white"); end |
#yellow ⇒ Object
130 |
# File 'lib/commands.rb', line 130 def yellow; execute("led.yellow"); end |