Created
March 16, 2019 08:50
-
-
Save shugo/3ae9ad42dda22d42aefd1e292cdd178e to your computer and use it in GitHub Desktop.
Red/Green LED example
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
# 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