Created
April 2, 2015 16:23
-
-
Save Marahin/93321c42f54f2825b94d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'daemons' | |
Daemons.run('leds.rb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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