Class: Pinoccio::PinCommands

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

Constant Summary collapse

INPUT =
"INPUT"
OUTPUT =
"OUTPUT"
INPUT_PULLUP =
"INPUT_PULLUP"
DISABLED =
"DISABLED"
HIGH =
"HIGH"
LOW =
"LOW"

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

#disable(pin) ⇒ Object



261
262
263
# File 'lib/commands.rb', line 261

def disable(pin)
  execute(%[pin.disable("#{pin}")])
end

#make_input(pin, pullup = INPUT_PULLUP) ⇒ Object



253
254
255
# File 'lib/commands.rb', line 253

def make_input(pin, pullup=INPUT_PULLUP)
  execute(%[pin.makeinput("#{pin}", #{pullup})])
end

#make_output(pin) ⇒ Object



257
258
259
# File 'lib/commands.rb', line 257

def make_output(pin)
  execute(%[pin.makeoutput("#{pin}")])
end

#read(pin) ⇒ Object



269
270
271
# File 'lib/commands.rb', line 269

def read(pin)
  get(%[pin.read("#{pin}")], :integer)
end

#report_analogObject



281
282
283
# File 'lib/commands.rb', line 281

def report_analog
  get('pin.report.analog', :json)
end

#report_digitalObject



277
278
279
# File 'lib/commands.rb', line 277

def report_digital
  get('pin.report.digital', :json)
end

#set_mode(pin, mode) ⇒ Object



265
266
267
# File 'lib/commands.rb', line 265

def set_mode(pin, mode)
  execute(%[pin.setmode("#{pin}", #{mode})])
end

#write(pin, value) ⇒ Object



273
274
275
# File 'lib/commands.rb', line 273

def write(pin, value)
  execute(%[pin.write("#{pin}", value)], :integer)
end