pxt-ev3/libs/core/battery.ts

13 lines
323 B
TypeScript
Raw Normal View History

2018-01-05 06:50:13 +01:00
namespace brick {
/**
* Returns the current battery level
*/
//% blockId=brickBatteryLevel block="battery level"
//% group="More"
//% help=brick/battery-level
2018-01-05 06:50:13 +01:00
export function batteryLevel(): number {
const info = sensors.internal.getBatteryInfo();
return info.current;
}
}