Skip to content

Instantly share code, notes, and snippets.

@descartez
Last active November 14, 2019 18:57
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 descartez/97bef1e1d6d8e602f1a78e372257223e to your computer and use it in GitHub Desktop.
Save descartez/97bef1e1d6d8e602f1a78e372257223e to your computer and use it in GitHub Desktop.
from microbit import *
while True:
moisture = pin0.read_analog()
if button_a.is_pressed():
if moisture <= 1023 and moisture > 0:
display.scroll(moisture)
else:
display.show(Image.SAD)
sleep(5000)
from microbit import *
while True:
if button_a.is_pressed():
pin1.write_analog(1023)
moisture = pin0.read_analog()
if moisture <= 1023 and moisture > 0:
display.scroll(moisture)
else:
display.show(Image.SAD)
pin1.write_analog(0)
sleep(200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment