Created
February 9, 2021 18:08
-
-
Save nasajpledu/b6c2e8128ede1ea5f1b6d56071e2b05f to your computer and use it in GitHub Desktop.
Code a Mars Landing - Step 3: Add a light indicator
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
red_led = LED("D2") | |
yellow_led = LED("D3") | |
green_led = LED("D4") | |
if distance < 10: | |
red_led.on() | |
yellow_led.on() | |
green_led.on() | |
elif distance < 20: | |
red_led.off() | |
yellow_led.on() | |
green_led.on() | |
else: | |
red_led.off() | |
yellow_led.off() | |
green_led.on() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment