crwdns277410:0crwdne277410:0
crwdns277412:0crwdne277412:0
crwdns277664:0crwdne277664:0 crwdns277416:0crwdne277416:0
crwdns277418:0crwdne277418:0
crwdns277420:0crwdne277420:0
crwdns277422:0crwdne277422:0
- crwdns277666:0crwdne277666:0
- crwdns277668:0crwdne277668:0
- crwdns277670:0crwdne277670:0
crwdns277430:0crwdne277430:0
- crwdns277434:0crwdne277434:0 crwdns277672:0crwdne277672:0
- crwdns277438:0crwdne277438:0
- crwdns277674:0crwdne277674:0 crwdns277442:0crwdne277442:0
- crwdns277444:0crwdne277444:0
- crwdns277446:0crwdne277446:0
crwdns277448:0crwdne277448:0
- crwdns277450:0crwdne277450:0
- crwdns277452:0crwdne277452:0
- crwdns277454:0crwdne277454:0
crwdns277456:0crwdne277456:0
1from microbit import *
2import music
3
4# Uses accelerometer readings in the x and y axis
5# and also allows the micro:bit to be slightly off-level
6# to make it work better in practice
7while True:
8 if accelerometer.get_x() > -10 and accelerometer.get_x() < 10 and accelerometer.get_y() > -10 and accelerometer.get_y() < 10:
9 display.show(Image.YES)
10 music.play('C5:1')
11 sleep(200)
12 else:
13 display.show(Image.NO)
14
crwdns277458:0crwdne277458:0
- crwdns277460:0crwdne277460:0
- crwdns277462:0crwdne277462:0
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.