Class: Pinoccio::LedCommands

Inherits:
CommandCollection show all
Defined in:
lib/commands.rb

Instance Method Summary collapse

Methods inherited from CommandCollection

#execute, #get, #initialize, #run

Constructor Details

This class inherits a constructor from Pinoccio::CommandCollection

Instance Method Details



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

#blueObject



126
# File 'lib/commands.rb', line 126

def blue; execute("led.blue"); end

#cyanObject



127
# File 'lib/commands.rb', line 127

def cyan; execute("led.cyan"); end

#greenObject



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

#magentaObject



129
# File 'lib/commands.rb', line 129

def magenta; execute("led.magenta"); end

#offObject



123
# File 'lib/commands.rb', line 123

def off; execute("led.off"); end

#orangeObject



131
# File 'lib/commands.rb', line 131

def orange; execute("led.orange"); end

#purpleObject



128
# File 'lib/commands.rb', line 128

def purple; execute("led.purple"); end

#redObject



124
# File 'lib/commands.rb', line 124

def red; execute("led.red"); end

#reportObject



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

#torchObject



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

#whiteObject



132
# File 'lib/commands.rb', line 132

def white; execute("led.white"); end

#yellowObject



130
# File 'lib/commands.rb', line 130

def yellow; execute("led.yellow"); end