Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example code using patlite.rb
require "./patlite"
Patlite.host = "192.168.254.209"
patlite = []
[:red, :yellow, :green].each do |i|
patlite << Patlite.new(i)
end
loop do
a = patlite.sample
p "target: #{a.target}"
old = a.state?
if a.off?
a.on
else
a.off
end
p "#{old} => #{a.state?}"
sleep (3..20).to_a.sample/10.0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment