mirror of
https://github.com/buzz-lightsnack-2007/MicroBit_SimpleCounter.git
synced 2024-08-14 23:50:57 +00:00
25 lines
No EOL
405 B
TypeScript
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() |