Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
e0c8f65a65 | |||
a4e02dcd03 |
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() {
|
||||
|
@ -1,9 +1,6 @@
|
||||
#include "pxt.h"
|
||||
#include "ev3const.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace output {
|
||||
|
||||
/**
|
||||
@ -20,7 +17,6 @@ Buffer createBuffer(int size) {
|
||||
namespace pxt {
|
||||
|
||||
void target_init() {
|
||||
mkdir(SETTINGSDIR, 0777);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
#define PXT_GC_THREAD_LIST 1
|
||||
|
||||
#define PXT_IN_ISR() false
|
||||
|
||||
#define SETTINGSDIR "/mnt/ramdisk/settings"
|
||||
|
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",
|
||||
@ -23,8 +24,7 @@
|
||||
"touch-sensor": "file:../touch-sensor",
|
||||
"ultrasonic-sensor": "file:../ultrasonic-sensor",
|
||||
"gyro-sensor": "file:../gyro-sensor",
|
||||
"infrared-sensor": "file:../infrared-sensor",
|
||||
"settings": "file:../settings"
|
||||
"infrared-sensor": "file:../infrared-sensor"
|
||||
},
|
||||
"palette": [
|
||||
"#ffffff",
|
||||
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "settings",
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/settings---files"
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-ev3",
|
||||
"version": "1.4.2",
|
||||
"version": "1.4.3",
|
||||
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
|
||||
"private": false,
|
||||
"keywords": [
|
||||
|
@ -18,8 +18,7 @@
|
||||
"libs/screen",
|
||||
"libs/ev3",
|
||||
"libs/storage",
|
||||
"libs/broadcast",
|
||||
"libs/settings"
|
||||
"libs/broadcast"
|
||||
],
|
||||
"simulator": {
|
||||
"autoRun": true,
|
||||
|
Reference in New Issue
Block a user