pxt-calliope/libs/core/basic.ts
Peli de Halleux e6c38b85b0
Display rounded number in basic.showNumber (#856)
* use roundWithPrecision in show num er

* fixng typing error

* upgraded pxt version
2018-06-04 22:31:04 -07:00

15 lines
546 B
TypeScript

namespace basic {
/**
* Scroll a number on the screen. If the number fits on the screen (i.e. is a single digit), do not scroll.
* @param interval speed of scroll; eg: 150, 100, 200, -100
*/
//% help=basic/show-number
//% weight=96
//% blockId=device_show_number block="show|number %number" blockGap=8
//% async
//% parts="ledmatrix" interval.defl=150
export function showNumber(value: number, interval?: number) {
showString(Math.roundWithPrecision(value, 2).toString(), interval);
}
}