Skip to content

crwdns342183:0crwdne342183:0

crwdns312192:0crwdne312192:0

crwdns338145:0crwdne338145:0 | MakeCode, Python | crwdns255566:0crwdne255566:0, crwdns255572:0crwdne255572:0, crwdns255578:0crwdne255578:0 | crwdns258500:0crwdne258500:0, crwdns258502:0crwdne258502:0, crwdns258504:0crwdne258504:0, crwdns258538:0crwdne258538:0

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

crwdns277432:0crwdne277432: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