Class: GPIO::Button

Inherits:
Object
  • Object
show all
Defined in:
lib/c_gpio.rb

Instance Method Summary collapse

Instance Method Details

#on_press(&block) ⇒ Object



22
23
24
25
26
# File 'lib/c_gpio.rb', line 22

def on_press(&block)
  Thread.new do
    wait_for_low(block)
  end
end

#on_release(&block) ⇒ Object



28
29
30
31
32
# File 'lib/c_gpio.rb', line 28

def on_release(&block)
  Thread.new do
    wait_for_high(block)
  end
end