Skip to content

Instantly share code, notes, and snippets.

@ma2shita
Created May 7, 2016 14:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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