pxt-ev3/libs/core/battery.ts

12 lines
290 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"
export function batteryLevel(): number {
const info = sensors.internal.getBatteryInfo();
return info.current;
}
}