Class: GPIO::OutputPin

Inherits:
Pin
  • Object
show all
Defined in:
lib/gpio/pins/output_pin.rb

Instance Attribute Summary

Attributes inherited from Pin

#device, #file, #hardware_pin, #mode, #pin, #software_pin

Instance Method Summary collapse

Methods inherited from Pin

#read

Constructor Details

#initialize(params) ⇒ OutputPin

(pin, mode, device=:RaspberryPi)



3
4
5
6
# File 'lib/gpio/pins/output_pin.rb', line 3

def initialize(params) #(pin, mode, device=:RaspberryPi)
	params.merge!(:mode => :out)
	super(params)
end

Instance Method Details

#offObject



12
13
14
15
# File 'lib/gpio/pins/output_pin.rb', line 12

def off
	device.write software_pin, 0
	read
end

#onObject



8
9
10
11
# File 'lib/gpio/pins/output_pin.rb', line 8

def on
	device.write software_pin, 1
	read
end