Class: Omega2Gpio::Output

Inherits:
Gpio
  • Object
show all
Defined in:
lib/omega2_gpio/output.rb

Instance Attribute Summary

Attributes inherited from Gpio

#gpio_number, #value

Instance Method Summary collapse

Methods inherited from Gpio

#get, #initialize, #is_high?, #is_low?, is_mock?, #read, #set_direction

Constructor Details

This class inherits a constructor from Omega2Gpio::Gpio

Instance Method Details

#set(value) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/omega2_gpio/output.rb', line 5

def set(value)
  if Omega2Gpio.configuration.mock
    Omega2Gpio.messenger.debug "Mocked GPIO#{self.gpio_number} is set to '#{value}'"
  else
    execute_fast_gpio_command "fast-gpio set #{self.gpio_number} #{value}"
  end
  @value = value

  self
end