Compare commits

..

4 Commits

Author SHA1 Message Date
e0c8f65a65 1.4.3 2019-10-09 09:57:53 -07:00
a4e02dcd03 add block to stop program (#943)
* add block to stop program

* renaming
2019-10-09 09:30:42 -07:00
fb5776ec41 1.4.2 2019-10-08 22:19:50 -07:00
d852fd961b fix python build 2019-10-08 22:19:34 -07:00
8 changed files with 41 additions and 6 deletions

View File

@ -0,0 +1,18 @@
# exit Program
Stops the program and returns to the brick menu
```sig
brick.exitProgram();
```
## Example
Do a sequence of motor commands and stop the program.
```blocks
motors.largeA.run(50)
pause(500)
motors.stopAll()
brick.exitProgram();
```

View File

@ -26,6 +26,7 @@ namespace brick {
*/
//% blockId=brickBatteryProperty block="battery %property"
//% group="Battery"
//% blockGap=8
//% help=brick/battery-property
export function batteryInfo(property: BatteryProperty): number {
const info = sensors.internal.getBatteryInfo();

View File

@ -85,7 +85,7 @@ namespace brick {
//% blockId=buttonIsPressed
//% parts="brick"
//% blockNamespace=brick
//% weight=81 blockGap=8
//% weight=81
//% group="Buttons"
//% button.fieldEditor="brickbuttons"
isPressed() {

View File

@ -208,12 +208,14 @@ namespace sensors.internal {
}
}
export function getBatteryInfo(): {
export interface BatteryInfo {
level: number;
Ibatt: number,
Vbatt: number,
Imotor: number
} {
}
export function getBatteryInfo(): BatteryInfo {
init();
if (!batteryInfo) updateBatteryInfo();
const CinCnt = batteryInfo.CinCnt;

13
libs/ev3/brick.ts Normal file
View File

@ -0,0 +1,13 @@
namespace brick {
/**
* Exits the program to the main menu. (in the simulator restarts it)
*/
//% blockId=loopstop block="exit program"
//% help=reference/brick/exit-program
//% weight=10
//% blockGap=8
//% group="Buttons"
export function exitProgram() {
control.reset();
}
}

View File

@ -1,6 +1,6 @@
//% color="#68C3E2" weight=100 icon="\uf106"
//% groups='["Buttons", "Screen", "Battery"]'
//% groups='["Buttons", "Screen", "Power"]'
//% labelLineWidth=60
namespace brick {
}

View File

@ -2,8 +2,9 @@
"name": "ev3",
"description": "The EV3 library",
"files": [
"README.md",
"README.md",
"ns.ts",
"brick.ts",
"startup.ts",
"images.jres",
"images.ts",

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "1.4.1",
"version": "1.4.3",
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
"private": false,
"keywords": [