Skip to content

Instantly share code, notes, and snippets.

@Marahin
Created April 2, 2015 16:23
Show Gist options
  • Save Marahin/93321c42f54f2825b94d to your computer and use it in GitHub Desktop.
Save Marahin/93321c42f54f2825b94d to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'daemons'
Daemons.run('leds.rb')
#!/usr/bin/env ruby
require 'pi_piper'
pin_ids = [26, 23, 18, 16, 12]
@pins = []
def fill_pins(pin_ids)
pin_ids.each do |pin_id|
temp_pin = PiPiper::Pin.new(:pin => pin_id, :direction => :out)
temp_pin.off
@pins << temp_pin
end
end
fill_pins(pin_ids)
while true do
pin = @pins.sample
pin.on
sleep(1)
pin.off
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment