pxt-ev3/libs/core/battery.ts
2018-01-04 21:50:13 -08:00

12 lines
290 B
TypeScript

namespace brick {
/**
* Returns the current battery level
*/
//% blockId=brickBatteryLevel block="battery level"
//% group="More"
export function batteryLevel(): number {
const info = sensors.internal.getBatteryInfo();
return info.current;
}
}