Compare commits

...

14 Commits

Author SHA1 Message Date
2b5cedb404 0.0.99 2018-02-13 11:26:41 -08:00
224e9c54f0 color dropdown for color sensor (#324) 2018-02-13 10:44:46 -08:00
f3f33828f3 Fixed the dropdown for colors (#323) 2018-02-12 21:23:16 -08:00
2905814898 0.0.98 2018-02-12 12:26:08 -08:00
96f1086c8f Applying UI updates from Lego (#322) 2018-02-12 12:23:25 -08:00
7bd2192a0a Fill in some ultrasonic sensor topics (#321)
* Fill in some ultrasonic sensor topics

* Busted link

* Adjust those sea also links

* Busted snippets
2018-02-11 09:01:46 -08:00
6f539de2d2 Touch sensor doc fill-in (#320) 2018-02-09 18:17:12 -08:00
1d83d6c40e 0.0.97 2018-02-09 10:26:28 -08:00
53bff7b133 updated package lock 2018-02-09 10:26:20 -08:00
2f6ad3110a motor blocks with optional args (#290)
* motor blocks with optional args

* updated signatures

* added toggle mode

* adding annotations
2018-02-09 10:25:39 -08:00
22ce840181 Widget fixes (#316)
* Use bBox in motor slider

* Use setRate instead of setAngle in gyro widget
2018-02-08 16:55:23 -08:00
d8589ea98c Discussion note for gyro precsion (#317)
* Discussion note for gyro precsion

* Wrong sig
2018-02-08 15:06:08 -08:00
adb577547d 0.0.96 2018-02-08 12:53:17 -08:00
ab6290c76d Add blocky grid (#313) 2018-02-08 11:49:26 -08:00
38 changed files with 1489 additions and 1178 deletions

View File

@ -69,6 +69,16 @@
* [clear counts](/reference/motors/motor/clear-counts)
* [stop all motors](/reference/motors/stop-all-motors)
* [Sensors](/reference/sensors)
* [angle](/reference/sensors/gyro/angle)
* [rate](/reference/sensors/gyro/rate)
* [reset](/reference/sensors/gyro/reset)
* [Touch](/reference/sensors/touch-sensor)
* [on event](/reference/sensors/touch-sensor/on-event)
* [pause until](/reference/sensors/touch-sensor/pause-until)
* [is pressed](/reference/sensors/touch-sensor/is-pressed)
* [was pressed](/reference/sensors/touch-sensor/was-pressed)
* [Gyro](/reference/sensors/gyro)
* [angle](/reference/sensors/gyro/angle)
* [rate](/reference/sensors/gyro/rate)
* [reset](/reference/sensors/gyro/reset)
* [Ultrasonic](/reference/sensors/ultrasonic)
* [on event](/reference/sensors/ultrasonic/on-event),
* [distance](reference/sensors/ultrasonic/distance),
* [pause until](reference/sensors/ultrasonic/pause-until)

View File

@ -6,11 +6,11 @@ Get the current angle of the motor's rotation in degrees.
motors.largeA.angle()
```
When a motor is started for the first time, or after a reset, it's angle of rotation starts at `0` degrees. A complete rotation (a turn in a full circle) is `360` degrees. At `360` degrees, the motor angle gets set back to `0`. So, one and a half turns adds up to `540` degrees of total rotation but the motor only cares about the current angle from `0` degrees which is `180` degrees.
When a motor is started for the first time, or after a reset, it's angle of rotation starts at `0` degrees. A complete rotation (a turn in a full circle) is `360` degrees. At `360` degrees, the motor angle doesn't go back to `0` but keeps counting in degrees. So, one and a half turns adds up to `540` degrees of total rotation.
## Returns
* a [number](/types/number) which is the current angle of rotation for the motor. The value returned is the number of degrees from `0` to `359`.
* a [number](/types/number) which is the current angle of rotation for the motor.
## Example

View File

@ -1,9 +1,26 @@
# Sensors
## Touch
```cards
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {})
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
sensors.touch1.wasPressed()
sensors.touch1.isPressed()
```
## Gyro
```cards
sensors.gyro1.angle();
sensors.gyro1.rate();
sensors.gyro1.reset();
```
```
## Ultrasonic
```cards
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () {});
sensors.ultrasonic1.distance();
sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

After

Width:  |  Height:  |  Size: 681 B

View File

@ -9,14 +9,14 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="101.07757"
height="100.57249"
viewBox="0 0 101.07757 100.57249"
width="76.47757"
height="75.972496"
viewBox="0 0 76.477571 75.972499"
id="svg4138"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
sodipodi:docname="simulator.svg"
inkscape:export-filename="/Users/sam/pxt-ev3/docs/static/backgrounds/simulator.png"
inkscape:export-filename="C:\Users\samelh\pxt-ev3\docs\static\backgrounds\simulator.png"
inkscape:export-xdpi="50.11311"
inkscape:export-ydpi="50.11311">
<defs
@ -29,20 +29,20 @@
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="4"
inkscape:cx="134.33221"
inkscape:cy="8.1953909"
inkscape:cx="60.782211"
inkscape:cy="-4.104587"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="28.3"
fit-margin-left="28.3"
fit-margin-right="28.3"
fit-margin-bottom="28.3"
fit-margin-top="16"
fit-margin-left="16"
fit-margin-right="16"
fit-margin-bottom="16"
units="px"
inkscape:window-width="2556"
inkscape:window-height="1395"
inkscape:window-x="4"
inkscape:window-y="1"
inkscape:window-width="3000"
inkscape:window-height="1875"
inkscape:window-x="-13"
inkscape:window-y="-13"
inkscape:window-maximized="1" />
<metadata
id="metadata4143">
@ -60,9 +60,9 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-68.659229,-124.25339)">
transform="translate(-80.959229,-136.55339)">
<ellipse
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.31372549"
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.47058824"
id="path4699"
cx="119.19801"
cy="174.53964"

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -19,22 +19,22 @@ enum LightIntensityMode {
}
const enum ColorSensorColor {
//% block="none" blockIdentity=sensors.color
//% block="none" jres=colors.none
None,
//% block="black" blockIdentity=sensors.color
//% block="black" jres=colors.black
Black,
//% block="blue" blockIdentity=sensors.color
//% block="blue" jres=colors.blue
Blue,
//% block="green" blockIdentity=sensors.color
//% block="green" jres=colors.green
Green,
//% block="yellow" blockIdentity=sensors.color
//% block="yellow" jres=colors.yellow
Yellow,
//% block="red" blockIdentity=sensors.color
//% block="red" jres=colors.red
Red,
//% block="white" blockIdentity=sensors.color
//% block="white" jres=colors.white
White,
//% block="brown" blockIdentity=sensors.color
Brown,
//% block="brown" jres=colors.brown
Brown
}
enum LightCondition {
@ -117,6 +117,11 @@ namespace sensors {
//% sensor.fieldEditor="ports"
//% weight=100 blockGap=12
//% group="Color Sensor"
//% color.fieldEditor="gridpicker"
//% color.fieldOptions.columns=4
//% color.fieldOptions.tooltips=true
//% color.fieldOptions.hideRect=true
//% color.fieldOptions.width=268
onColorDetected(color: ColorSensorColor, handler: () => void) {
this.setMode(ColorSensorMode.Color)
const v = this._colorEventValue(<number>color);
@ -137,6 +142,11 @@ namespace sensors {
//% sensor.fieldEditor="ports"
//% weight=99 blockGap=8
//% group="Color Sensor"
//% color.fieldEditor="gridpicker"
//% color.fieldOptions.columns=4
//% color.fieldOptions.tooltips=true
//% color.fieldOptions.hideRect=true
//% color.fieldOptions.width=268
pauseForColor(color: ColorSensorColor) {
this.setMode(ColorSensorMode.Color);
if (this.color() != color) {

View File

@ -0,0 +1,30 @@
{
"*": {
"namespace": "colors",
"dataEncoding": "base64"
},
"black": {
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAszD0iAAAAQB0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AFP3ByUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAALklEQVRYR+3MQQ0AIAADM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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH8gKTMAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAAG0lEQVRYR+3BgQAAAADDoPlT3+AEVQAAAABXDRBAAAFce08FAAAAAElFTkSuQmCC"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

View File

@ -3,6 +3,7 @@
"description": "Color Sensor support",
"files": [
"README.md",
"colors.jres",
"color.ts"
],
"testFiles": [

View File

@ -223,9 +223,10 @@ namespace motors {
* @param value (optional) measured distance or rotation
* @param unit (optional) unit of the value
*/
//% blockId=motorSetSpeed block="set %motor|speed to %speed=motorSpeedPicker|%"
//% blockId=motorSetSpeed block="set %motor speed to %speed=motorSpeedPicker|\\%||for %value %unit"
//% weight=100 blockGap=8
//% group="Move"
//% expandableArgumentMode=toggle
//% help=motors/motor/set-speed
setSpeed(speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
this.init();
@ -495,10 +496,11 @@ namespace motors {
* @param value (optional) move duration or rotation
* @param unit (optional) unit of the value
*/
//% blockId=motorPairTank block="tank %motors|%speedLeft=motorSpeedPicker|%|%speedRight=motorSpeedPicker|%"
//% blockId=motorPairTank block="tank %motors %speedLeft=motorSpeedPicker|\\% %speedRight=motorSpeedPicker|\\%||for %value %unit"
//% weight=96 blockGap=8
//% inlineInputMode=inline
//% group="Move"
//% expandableArgumentMode=toggle
//% help=motors/synced/tank
tank(speedLeft: number, speedRight: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
this.init();
@ -521,11 +523,12 @@ namespace motors {
* @param value (optional) move duration or rotation
* @param unit (optional) unit of the value
*/
//% blockId=motorPairSteer block="steer %chassis|turn ratio %turnRatio=motorTurnRatioPicker|speed %speed=motorSpeedPicker|%"
//% blockId=motorPairSteer block="steer %chassis turn ratio %turnRatio=motorTurnRatioPicker speed %speed=motorSpeedPicker|\\%||for %value %unit"
//% weight=95
//% turnRatio.min=-200 turnRatio=200
//% inlineInputMode=inline
//% group="Move"
//% expandableArgumentMode=toggle
//% help=motors/synced/steer
steer(turnRatio: number, speed: number, value: number = 0, unit: MoveUnit = MoveUnit.MilliSeconds) {
this.init();

View File

@ -0,0 +1,13 @@
# Gyro sensor
```cards
sensors.gyro1.angle();
sensors.gyro1.rate();
sensors.gyro1.reset();
```
## See Also
[angle](/reference/sensors/gyro/angle),
[rate](/reference/sensors/gyro/rate),
[reset](/reference/sensors/gyro/reset)

View File

@ -3,11 +3,35 @@
Get the current rotation angle of the gyro.
```sig
sensors.gyro2.rate()
sensors.gyro2.angle()
```
When the brick changes its position, it's moved in the direction of one of the axes used to measure three-dimensional space. Depending on where the gyro sensor is attached, it can measure the difference in angle from where it was before it moved. This angle is measured in degrees. The angle is the number of degrees rotated from where the gyro was last [reset](/reference/sensors/gyro/reset).
## ~hint
## Accuracy and calibration
Gyro sensors aren't perfectly accurate. Sometimes, because of temperature and changes in the way elecricity behaves in the sensor, the gyro returns a small error in it's measurement. This causes the gyro sensor to return an incorrect value for the amount of angle it detected. This might make your robot drive off course and not go to where you want it to.
### Drift
If you want to turn the tank or robot you built to the left by 45 degrees, you might run the motor on the right side until the gyro reported that you turned by 45 degrees. What if the gyro was getting an error of 4 degrees every time it measured an angle? You may have actually turned 49 degrees when you expected to turn 45 degrees. Well, that might not be too bad if you use the gyro's angle value only once. It's fine if you just wanted to turn and stop or drive a short distance in only that direction.
The problem is that when you need to read the angle measurement frequently, the amount of error in the angle measurement may continue to increase. If the sensor thought it moved by 45 degrees the first time instead of really 49 degrees, your second turn will put you at 98 degrees when the sensor said 90 degrees. If you want a robot to turn right 90 degrees and drive for 5 meters, it might actually turn 98 degrees and drive 0.7 meters off course before it stops. This error in the sensor's measurement is called _drift_.
### Time to reset
If errors in the angle values returned by the gyro sensor are making your project not work right, then it's time to **[reset](/reference/sensors/gyro/reset)**. A reset will return the gyro sensor's current angle value back to `0` and _calibrate_ for drift. Calibration is the process of finding out how much error there is in a sensor's measurement and then removing the error from the value returned to your program.
Are you using a gyro sensor in your project and need accuracy for your angle values? You should reset the gyro sensor at a regular intervals to improve precision in the values reported to your program.
### Handling imprecision
Unfortunately, the angle values returned from the [gyro sensor](https://education.lego.com/en-us/products/ev3-gyro-sensor-/45505) are going to have some inaccuracy even when calibrated. The error could be as muchs as 3 degrees in either direction of rotation (`3` or `-3` degrees). So, you need to decide how precise your angle measurments need to be and have your code handle the possiblity that angle values aren't always exact.
## ~
## Returns
* a [number](/types/number) that is the current angle of rotation in degrees.

View File

@ -1,5 +1,18 @@
# is Pressed
Check to see if a touch sensor is currently pressed or not.
```sig
sensors.touch1.isPressed()
```
## Returns
* a [boolean](/types/boolean) value that is `true` if the sensor is currently pressed. It's `false` if the sensor is not pressed.
## Example
If the touch sensor ``touch 1`` is pressed, show a `green` status light. Otherwise, set the status light to `orange`.
```blocks
loops.forever(function () {
if (sensors.touch1.isPressed()) {
@ -8,4 +21,8 @@ loops.forever(function () {
brick.setStatusLight(StatusLight.Orange)
}
})
```
```
## See also
[was pressed](/reference/sensors/touch-sensor/was-pressed), [on event](/reference/sensors/touch-sensor/on-event)

View File

@ -1,16 +1,33 @@
# On Event
# on Event
Run some code when a touch sensor is pressed, bumped, or released.
```sig
sensors.touch1.onEvent(ButtonEvent.Released, function () { })
sensors.touch1.onEvent(ButtonEvent.Bumped, function () {
});
```
# Parameters
## Parameters
## Examples
* **ev**: the touch sensor action to run some code for. The the touch actions (events) are:
> * ``pressed``: the sensor was pressed, or pressed and released
> * ``bumped``: the sensor was just bumped
> * ``released``: the sensor was just released
* **body**: the code you want to run when something happens to the touch sensor.
## Example
Check for an event on touch sensor ``touch 1``. Put an expression on the screen when the senosr is released.
```blocks
sensors.touch1.onEvent(ButtonEvent.Released, function () {
brick.showImage(images.expressionsSick)
})
```
### See also
[is pressed](/reference/sensors/touch-sensor/is-pressed),
[was pressed](/reference/sensors/touch-sensor/was-pressed),
[pause until](/reference/sensors/touch-sensor/pause-until)

View File

@ -0,0 +1,37 @@
# pause Until
Make your program wait until an event at a touch sensor happens.
```sig
sensors.touch1.pauseUntil(ButtonEvent.Bumped);
```
## Parameters
* **ev**: the touch sensor action to wait for. The the touch actions (events) are:
> * ``pressed``: the sensor was pressed, or pressed and released
> * ``bumped``: the sensor was just bumped
> * ``released``: the sensor was just released
## Example
Wait for a bump to touch sensor `touch 1` before continuing with displaying a message on the screen.
```blocks
let waitTime = 0;
brick.showString("We're going to wait", 1);
brick.showString("for you to bump the", 2);
brick.showString("touch sensor on port 1", 3);
waitTime = control.millis();
sensors.touch1.pauseUntil(ButtonEvent.Bumped);
brick.clearScreen();
if (control.millis() - waitTime > 5000) {
brick.showString("Ok, that took awhile!", 1)
} else {
brick.showString("Ah, you let go!", 1)
}
```
## See also
[on event](/reference/sensors/touch-sensor/on-event)

View File

@ -1,5 +1,21 @@
# was Pressed
See if a touch sensor was pressed since the last time it was checked.
```sig
sensors.touch1.wasPressed()
```
If a touch sensor was pressed, then that event is remembered. Once you check if a touch sensor **was pressed**, that status is set back to `false`. If you check again before the sensor is touched another time, the **was pressed** status is `false`. Only when the sensor is touched will the **was pressed** status go to `true`.
## Returns
* a [boolean](/types/boolean) value that is `true` if the sensor is was pressed before. It's `false` if the sensor was not pressed.
## Example
If the touch sensor ``touch 1`` was pressed, show a `green` status light. Otherwise, set the status light to `orange`.
```blocks
loops.forever(function () {
if (sensors.touch1.wasPressed()) {
@ -7,5 +23,10 @@ loops.forever(function () {
} else {
brick.setStatusLight(StatusLight.Orange)
}
loops.pause(500)
})
```
```
## See also
[is pressed](/reference/sensors/touch-sensor/is-pressed), [on event](/reference/sensors/touch-sensor/on-event)

View File

@ -29,7 +29,7 @@ namespace sensors {
* @param event the kind of button gesture that needs to be detected
* @param body code to run when the event is raised
*/
//% help=input/touch-sensor/on-event
//% help=sensors/touch-sensor/on-event
//% blockId=touchEvent block="on %sensor|%event"
//% parts="touch"
//% blockNamespace=sensors
@ -45,7 +45,7 @@ namespace sensors {
* @param sensor the touch sensor that needs to be clicked or used
* @param event the kind of button gesture that needs to be detected
*/
//% help=input/touch-sensor/pause-until
//% help=sensors/touch-sensor/pause-until
//% blockId=touchWaitUntil block="pause until %sensor|%event"
//% parts="touch"
//% blockNamespace=sensors
@ -60,7 +60,7 @@ namespace sensors {
* Check if touch sensor is touched.
* @param sensor the port to query the request
*/
//% help=input/touch-sensor/is-pressed
//% help=sensors/touch-sensor/is-pressed
//% block="%sensor|is pressed"
//% blockId=touchIsPressed
//% parts="touch"
@ -76,7 +76,7 @@ namespace sensors {
* Check if touch sensor is touched since it was last checked.
* @param sensor the port to query the request
*/
//% help=input/touch-sensor/was-pressed
//% help=sensors/touch-sensor/was-pressed
//% block="%sensor|was pressed"
//% blockId=touchWasPressed
//% parts="touch"

View File

@ -0,0 +1,13 @@
# Ultrasonic sensor
```cards
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () {});
sensors.ultrasonic1.distance();
sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
```
## See Also
[on event](/reference/sensors/ultrasonic/on-event),
[distance](reference/sensors/ultrasonic/distance),
[pause until](reference/sensors/ultrasonic/pause-until)

View File

@ -0,0 +1,30 @@
# distance
The distance of an object detected by the ultrasonic sensor.
```sig
sensors.ultrasonic1.distance()
```
The distance value returned is the number of centimeters to the object that the sensor is currently detecting.
## Returns
* a [number](/types/number) that is the distance of the object detected by the ultrasonic sensor in centimeters.
## Example
When the ultrasonic sensor on port 4 detects a far object, display its distance on the screen.
```blocks
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectFar, function () {
brick.showString("Object detected at:", 1)
brick.showNumber(sensors.ultrasonic4.distance(), 2)
brick.showString("centimeters", 3)
})
```
## See also
[on event](/reference/sensors/ultrasonic/on-event), [pause until](/reference/sensors/ultrasonic/pause-until)

View File

@ -0,0 +1,39 @@
# on Event
Run some code when an object is detected by the ultrasonic sensor.
```sig
sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
```
How an object is detected depends on the distance and movement _thresholds_ set for the sensor. A threshold is a number that is some distance in centimeters or the strength of ultrasonic sound. You can set a distance to detect something that is far, near, or is sending out ultrasound (like the sensor of another robot in the area). The three thresholds you can set are:
* **near**: a distance to set to detect objects coming close
* **far**: a distance to set to detect objects farther away but not as close as the **near** threshold
* **detected**: the strength of ultrasound to needed to detect presence of another ultrasonic sensor
Both **near** and **far** have distance thresholds set in centimeters. The **detect** threshold is a value of strength the ultrasonic sound in decibels.
## Parameters
* **event**: the object detection action to wait for. The detection types (events) are:
> * ``object detected``: some other object is sending out an ultrasonic sound
> * ``object near``: the sensor detected something within the distance of the near threshold
> * ``object far``: the sensor detected somethin within the distance of the far threshold
* **body**: the code you want to run when something happens to the touch sensor.
## Example
When the ultrasonic sensor on port 4 detects a far object, display its distance on the screen.
```blocks
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectFar, function () {
brick.showString("Object detected at:", 1)
brick.showNumber(sensors.ultrasonic4.distance(), 2)
brick.showString("centimeters", 3)
})
```
## See also
[pause until](/reference/sensors/ultrasonic/pause-until)

View File

@ -0,0 +1,38 @@
# pause Until
Make your program wait until an some object is detected in proximity of the sensor.
```sig
sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
```
How an object is detected depends on the distance and movement _thresholds_ set for the sensor. A threshold is a number that is some distance in centimeters or the strength of ultrasonic sound. You can set a distance to detect something that is far, near, or is sending out ultrasound (like the sensor of another robot in the area). The three thresholds you can set are:
* **near**: a distance to set to detect objects coming close
* **far**: a distance to set to detect objects farther away but not as close as the **near** threshold
* **detected**: the strength of ultrasound to needed to detect presence of another ultrasonic sensor
Both **near** and **far** have distance thresholds set in centimeters. The **detect** threshold is a value of strength the ultrasonic sound in decibels.
## Parameters
* **event**: the object detection action to wait for. The detection types (events) are:
> * ``object detected``: some other object is sending out an ultrasonic sound
> * ``object near``: the sensor detected something within the distance of the near threshold
> * ``object far``: the sensor detected somethin within the distance of the far threshold
## Example
Wait for another object sending out ultrasonic sound. Show a message on the screen when it's dectected.
```blocks
brick.showString("Waiting for another", 1);
brick.showString("robot to appear...", 2);
sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
brick.showString("Hey, I just heard", 1)
brick.showString("Something!", 2);
```
## See also
[on event](/reference/sensors/ultrasonic/on-event)

View File

@ -41,7 +41,7 @@ namespace sensors {
* Registers code to run when the given color is close
* @param handler the code to run when detected
*/
//% help=input/ultrasonic/on
//% help=sensors/ultrasonic/on-event
//% blockId=ultrasonicOn
//% block="on %sensor|%event"
//% parts="ultrasonicsensor"
@ -56,7 +56,7 @@ namespace sensors {
/**
* Waits for the event to occur
*/
//% help=input/ultrasonic/wait
//% help=sensors/ultrasonic/pause-until
//% block="pause until %sensor| %event"
//% blockId=ultrasonicWait
//% parts="ultrasonicsensor"
@ -72,7 +72,7 @@ namespace sensors {
* Gets the distance from the sonar in centimeters
* @param sensor the ultrasonic sensor port
*/
//% help=input/ultrasonic/distance
//% help=sensors/ultrasonic/distance
//% block="%sensor|distance"
//% blockId=sonarGetDistance
//% parts="ultrasonicsensor"

2173
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.0.95",
"version": "0.0.99",
"description": "LEGO Mindstorms EV3 for Microsoft MakeCode",
"private": true,
"keywords": [
@ -44,8 +44,8 @@
"webfonts-generator": "^0.4.0"
},
"dependencies": {
"pxt-common-packages": "0.18.1",
"pxt-core": "3.3.1"
"pxt-common-packages": "0.19.1",
"pxt-core": "3.4.1"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"

View File

@ -127,12 +127,18 @@
"invertedMenu": false,
"invertedMonaco": false,
"monacoToolbox": true,
"invertedToolbox": true,
"invertedToolbox": false,
"coloredToolbox": true,
"hasAudio": true,
"usbHelp": [],
"extendEditor": true,
"disableBlockIcons": true,
"blocklyOptions": {
"grid": {
"spacing": 40,
"length": 2,
"colour": "#ddd"
}
},
"blockColors": {
"loops": "#58AB41",

View File

@ -86,9 +86,11 @@ namespace pxsim.visuals {
private prevVal: number;
private updateSliderValue(pt: SVGPoint, parent: SVGSVGElement, ev: MouseEvent) {
let cur = svg.cursorPoint(pt, parent, ev);
let bBox = this.content.getBoundingClientRect();
const coords = {
x: cur.x / this.scaleFactor - this.left / this.scaleFactor,
y: cur.y / this.scaleFactor - this.top / this.scaleFactor
x: cur.x / this.scaleFactor - bBox.left / this.scaleFactor,
y: cur.y / this.scaleFactor - bBox.top / this.scaleFactor
};
const radius = MotorSliderControl.SLIDER_RADIUS / 2;
const dx = coords.x - radius;

View File

@ -76,7 +76,7 @@ namespace pxsim.visuals {
let t = Math.max(0, Math.min(1, (width + bBox.left / this.scaleFactor - cur.x / this.scaleFactor) / width))
const state = this.state;
state.setAngle((1 - t) * (100));
state.setRate((1 - t) * (100));
}
}

View File

@ -31,6 +31,7 @@ span.blocklyTreeIcon {
/*box-shadow: inset 0px 0px 0px 2px #D3A805;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;*/
box-shadow: 3px 0 1px -2px @legoGreyLight;
}
div.blocklyTreeRow {
@ -39,10 +40,14 @@ div.blocklyTreeRow {
/*-webkit-box-shadow: inset 0px 0px 0px 3px rgba(0,0,0,0.2);
-moz-box-shadow: inset 0px 0px 0px 3px rgba(0,0,0,0.2);
box-shadow: inset 0px 0px 0px 3px rgba(0,0,0,0.2);*/
border: none !important;
border-bottom: 1px solid #EBEBEB !important;
}
div.blocklyTreeSeparator {
border-bottom: solid #CEA403 2px;
border: none;
/*border-bottom: solid #CEA403 2px;*/
}
/* Remove shadow around blockly blocks */
@ -66,9 +71,9 @@ span.blocklyTreeLabel {
}
.blocklySearchInputField {
border-radius: 1rem !important;
border: 1px solid #ebebeb !important;
}
/* Square shaped corners */
.blocklyDropDownDiv {
border-radius: 0px !important;

View File

@ -8,6 +8,6 @@
}
#mainmenu {
background: #f4f7f9;
background: @legoGreyLight;
border-bottom: 5px solid #00a5c8;
}

View File

@ -27,9 +27,11 @@
@orange: #fa7f2a;
@green: @brightYellowishGreen;
@legoGreyLight: #eaeeef;
@legoGreyLight: #F4F1F4;
@legoGreyDark: #f4f7f9;
@grey: @legoGreyLight;
/* Lego official colors */
/* Solid */
@ -126,7 +128,7 @@
--------------------*/
@simulatorBackground: #D6EDFF; /* #FFF */ /* #fcfbfa; */
@editorToolsBackground: #fff; /* #fcfbfa; */
@editorToolsBackground: @legoGreyLight; /* #fff;*/ /* #fcfbfa; */
@blocklySvgColor: #f9f9f9; /*#f2f6f8;*/ /*ecf6fe;*/
@homeScreenBackground: #EAEEEF;
@ -149,8 +151,8 @@
Editor
--------------------*/
@blocklyToolboxColor: #FAC80A;
@trashIconColor: white;
@blocklyToolboxColor: #FFF; /*#FAC80A;*/
@trashIconColor: #FAC80A; /*white*/
/*-------------------

View File

@ -29,11 +29,23 @@
&:extend(.ui.primary.button all);
}
.ui.button.editortools-btn {
&:extend(.ui.blue.button all);
@buttonBackgroundColor: white;
@buttonForegroundColor: #5E5E5E;
.ui.button.editortools-btn, .simtoolbar .ui.button,
.ui.button.collapse-button, .ui.button.collapsed-button {
background-color: @buttonBackgroundColor;
color: @buttonForegroundColor;
border: none !important;
box-shadow: none !important;
}
.ui.button.editortools-btn:hover,
.ui.button.editortools-btn:focus {
color: darken(@buttonForegroundColor, 0.2) !important;
}
.projectname-input {
.ui.input.projectname-input input {
box-shadow: none; border: none !important;
}
.ui.button.getting-started-btn {
@ -93,7 +105,7 @@
}
#downloadArea {
background: white;
background: @legoGreyLight;
}
/* Mobile */
@ -109,15 +121,18 @@
/* Small Monitor */
@media only screen and (min-width: @computerBreakpoint) and (max-width: @largestSmallMonitor) {
#editortools, #downloadArea {
background: #828A95;
}
}
/* Large Monitor */
@media only screen and (min-width: @largeMonitorBreakpoint) {
#editortools, #downloadArea {
background: #828A95;
}
/* >= Small Monitor (Small Monitor + Large Monitor + Wide Monitor) */
@media only screen and (min-width: @computerBreakpoint) {
.fullscreensim #boardview {
background: @simulatorBackground data-uri("../docs/static/backgrounds/simulator.png") 0 0 repeat !important;
}
}
/* Mobile, Tablet AND thin screen */