add block to stop program (#943)
* add block to stop program * renaming
This commit is contained in:
		
							
								
								
									
										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() {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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 {
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
    "files": [
 | 
			
		||||
        "README.md",        
 | 
			
		||||
        "ns.ts",
 | 
			
		||||
        "brick.ts",
 | 
			
		||||
        "startup.ts",
 | 
			
		||||
        "images.jres",
 | 
			
		||||
        "images.ts",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user