MicroBit_SimpleCounter/main.ts
2022-10-29 20:33:29 +08:00

25 lines
No EOL
405 B
TypeScript

/**
CounterTracker
simple counter tracker for the Micro:Bit
*/
input.onButtonPressed(Button.A, function () {
count += 1;
basic.showNumber(count)
})
input.onButtonPressed(Button.AB, function() {
count = 0;
basic.showNumber(count)
})
function startup(): boolean {
music.ringTone(Note.C)
count = 0;
basic.showNumber(count)
return true
}
let count = 0;
startup()