Skip to content

Instantly share code, notes, and snippets.

@bazwilliams
Created May 15, 2017 13:32
Show Gist options
  • Save bazwilliams/b444417d623d5330c304c29400ebc5a2 to your computer and use it in GitHub Desktop.
Save bazwilliams/b444417d623d5330c304c29400ebc5a2 to your computer and use it in GitHub Desktop.
BBC Micro:bit Toothbrush timer project. Create a new project at https://pxt.microbit.org/, choose the javascript tab and paste this code in.
input.onButtonPressed(Button.A, () => {
music.beginMelody(music.builtInMelody(Melodies.PowerUp), MelodyOptions.Once)
basic.showNumber(3)
basic.pause(20)
basic.showNumber(2)
basic.pause(20)
basic.showNumber(1)
basic.pause(20)
basic.showString("Go!")
music.beginMelody(music.builtInMelody(Melodies.JumpUp), MelodyOptions.Once)
images.createImage(`
# # . . .
# # . . .
. . . . .
. . . . .
. . . . .
`).showImage(0)
basic.pause(20000)
music.beginMelody(music.builtInMelody(Melodies.JumpUp), MelodyOptions.Once)
images.createImage(`
. . . . .
. . . . .
. . . . .
# # . . .
# # . . .
`).showImage(0)
basic.pause(20000)
music.beginMelody(music.builtInMelody(Melodies.JumpUp), MelodyOptions.Once)
images.createImage(`
. . . # #
. . . # #
. . . . .
. . . . .
. . . . .
`).showImage(0)
basic.pause(20000)
music.beginMelody(music.builtInMelody(Melodies.JumpUp), MelodyOptions.Once)
images.createImage(`
. . . . .
. . . . .
. . . . .
. . . # #
. . . # #
`).showImage(0)
basic.pause(20000)
music.beginMelody(music.builtInMelody(Melodies.JumpUp), MelodyOptions.Once)
images.createImage(`
. . . . .
. . . . .
. . . . .
. # # # .
. # # # .
`).showImage(0)
basic.pause(20000)
music.beginMelody(music.builtInMelody(Melodies.JumpUp), MelodyOptions.Once)
images.createImage(`
. # # # .
. # # # .
. . . . .
. . . . .
. . . . .
`).showImage(0)
basic.pause(20000)
music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once)
images.createImage(`
. # . # .
. . . . .
# . . . #
# # # # #
. # # # .
`).showImage(0)
basic.pause(4000)
basic.clearScreen()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment