Skip to content

Instantly share code, notes, and snippets.

@shugo
Created March 16, 2019 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shugo/3ae9ad42dda22d42aefd1e292cdd178e to your computer and use it in GitHub Desktop.
Save shugo/3ae9ad42dda22d42aefd1e292cdd178e to your computer and use it in GitHub Desktop.
Red/Green LED example
# mrblib/loops/master.rb
thermistor = Thermistor.new
led = Led.new(19)
led2 = Led.new(21)
while true
puts "temperature: #{thermistor.temperature}"
if thermistor.temperature > 30
led.turn_on
led2.turn_off
else
led2.turn_on
led.turn_off
end
sleep 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment