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 hours2,339
Micro:bit Top Revolution Counter

Things used in this project

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 • 4 followers
Teacher, dad, reformed skydiver, friend to dogs, food truck aficionado.

Comments