class PiGPIO
Constants
- ERRORS
Attributes
gpios[R]
Public Class Methods
new()
click to toggle source
# File lib/pigpiod.rb, line 14 def initialize @pigpio = File.open("/dev/pigpio", "wb") @pigout = File.open("/dev/pigout", "rb") @gpios = Array.new(54) { |g| GPIO.new(self, g) } end
Public Instance Methods
inspect()
click to toggle source
# File lib/pigpiod.rb, line 21 def inspect "#<PiGPIO>" end
Private Instance Methods
command(command)
click to toggle source
# File lib/pigpiod.rb, line 27 def command(command) @pigpio.puts(command) @pigpio.flush @pigout.wait_readable result = @pigout.read_nonblock(256).strip.to_i if result.negative? error_index = -result - 1 raise Error.new(result, ERRORS[error_index]) end result end