Created
January 25, 2016 23:16
-
-
Save andreagrandi/f4a7c8ee8597dde3070d to your computer and use it in GitHub Desktop.
MicroBit accelerometer example: show an happy face if kept straight or a sad one if bended
This file contains hidden or 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
import microbit as m | |
SENSITIVITY = 250 | |
while (True): | |
x = m.accelerometer.get_x() | |
if abs(x) < SENSITIVITY: | |
m.display.show(m.Image.HAPPY) | |
else: | |
m.display.show(m.Image.SAD) | |
m.sleep(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment