Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 405 Bytes

pi_piper.md

File metadata and controls

29 lines (21 loc) · 405 Bytes

Read from a GPIO

require 'pi_piper'
include PiPiper

watch :pin => 23 do
  puts "Pin changed from #{last_value} to #{value}"
end

#Or

after :pin => 23, :goes => :high do
  puts "Button pressed"
end

PiPiper.wait

Write to a GPIO

pin = PiPiper::Pin.new(:pin => 17, :direction => :out)
pin.on
sleep 1
pin.off

Reference: Pi Piper gem