class RouteC::Lights
Public Class Methods
new(array)
click to toggle source
# File lib/route_c/lights.rb, line 4 def initialize(array) @array, @config = array, Config.new end
Public Instance Methods
lights()
click to toggle source
# File lib/route_c/lights.rb, line 19 def lights @lights ||= @config.lights.map { |p| PiPiper::Pin.new(pin: p, direction: :out) } end
release()
click to toggle source
# File lib/route_c/lights.rb, line 23 def release lights.map { |l| l.release } end
turn_on()
click to toggle source
# File lib/route_c/lights.rb, line 8 def turn_on @array.each_with_index do |b, i| if b == 1 lights[i].on sleep @config.interval end end sleep @config.pause lights.reverse.each { |l| l.off ; sleep @config.interval } end