Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
e0c8f65a65 | |||
a4e02dcd03 | |||
fb5776ec41 | |||
d852fd961b |
18
docs/reference/brick/exit-program.md
Normal file
18
docs/reference/brick/exit-program.md
Normal 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();
|
||||
```
|
@ -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();
|
||||
|
@ -85,7 +85,7 @@ namespace brick {
|
||||
//% blockId=buttonIsPressed
|
||||
//% parts="brick"
|
||||
//% blockNamespace=brick
|
||||
//% weight=81 blockGap=8
|
||||
//% weight=81
|
||||
//% group="Buttons"
|
||||
//% button.fieldEditor="brickbuttons"
|
||||
isPressed() {
|
||||
|
@ -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
13
libs/ev3/brick.ts
Normal 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();
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
|
||||
//% color="#68C3E2" weight=100 icon="\uf106"
|
||||
//% groups='["Buttons", "Screen", "Battery"]'
|
||||
//% groups='["Buttons", "Screen", "Power"]'
|
||||
//% labelLineWidth=60
|
||||
namespace brick {
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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": [
|
||||
|
Reference in New Issue
Block a user