Ikaika StoneDouglas Kiang
Published © GPL3+

Micro:bit Top Revolution Counter

A Micro:bit attached to a self made top, that will count the number of times the top spins in a circle.

IntermediateFull instructions provided5 hours690
Micro:bit Top Revolution Counter

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
Compact Disc
×1
AA Batteries
AA Batteries
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Story

Read more

Code

Micro:bit Top Revolution Counter

Java
This code was originally created as a block based coding, that was converted to java code. This code is used to count and display the number of spins a top does.
let Spin = 0
input.onButtonPressed(Button.A, () => {
    Spin = 0
    basic.forever(() => {
        if (input.rotation(Rotation.Roll) > 360) {
            basic.showNumber(Spin + 1)
        }
    })
})

Credits

Ikaika Stone

Ikaika Stone

1 project • 0 followers
Douglas Kiang

Douglas Kiang

5 projects • 3 followers
Teacher, dad, reformed skydiver, friend to dogs, food truck aficionado.

Comments

Add projectSign up / LoginAbout BBC micro:bit