Compare commits
47 Commits
Author | SHA1 | Date | |
---|---|---|---|
653d8f6f5c | |||
ac0a9f0710 | |||
2cce2a39b8 | |||
a337403afa | |||
fd9d118fa4 | |||
e94ac6f6f1 | |||
88c58b4e76 | |||
e2eb5f35af | |||
71fe612ced | |||
e58ec06e91 | |||
538493369b | |||
56dd8e0875 | |||
1f7ef637b2 | |||
f4f2e0ba0e | |||
22c31c57df | |||
6879961297 | |||
69fcb7407a | |||
4dfada877c | |||
b10b636766 | |||
ba47fb0589 | |||
f36e14fe69 | |||
8bab919db2 | |||
89a82b54dc | |||
15ee6ebe9c | |||
9bf50665fc | |||
f594cdefac | |||
5ce7a83f5d | |||
d7ef7c353c | |||
c7cb300cd9 | |||
4e194536d3 | |||
570cd7474f | |||
9ea5597734 | |||
2c0cc6a3d7 | |||
08f79c5a1a | |||
f817912e07 | |||
603932c2b6 | |||
a0907e7229 | |||
635d4a7624 | |||
69d3938d85 | |||
f08f9105ba | |||
7228cbe1cb | |||
1ea0a0172a | |||
d548dfb578 | |||
a52ce112dc | |||
ea956f1a73 | |||
ba1b9a54b4 | |||
59e39fa76d |
3
.gitignore
vendored
@ -16,6 +16,9 @@ clients/win10/*.opendb
|
||||
clients/**/bin/**
|
||||
clients/**/obj/**
|
||||
clients/electron/projects
|
||||
libs/**/_locales/**
|
||||
libs/**/shims.d.ts
|
||||
libs/**/enums.d.ts
|
||||
|
||||
videos/**
|
||||
|
||||
|
@ -48,10 +48,23 @@
|
||||
* [show mood](/reference/brick/show-mood)
|
||||
* [show image](/reference/brick/show-image)
|
||||
* [clear screen](/reference/brick/clear-screen)
|
||||
* [print ports](/reference/brick/print-ports)
|
||||
* [on event](/reference/brick/button/on-event)
|
||||
* [is pressed](/reference/brick/button/is-pressed)
|
||||
* [was pressed](/reference/brick/button/was-pressed)
|
||||
* [pause until](/reference/brick/button/pause-until)
|
||||
* [set light](/reference/brick/set-light)
|
||||
* [set light](/reference/brick/set-status-light)
|
||||
* [battery level](/reference/brick/battery-level)
|
||||
* [Motors](/reference/motors)
|
||||
* [set speed](/reference/motors/motor/set-speed)
|
||||
* [stop](/reference/motors/motor/stop)
|
||||
* [reset](/reference/motors/motor/reset)
|
||||
* [set brake](/reference/motors/motor/set-brake)
|
||||
* [set inverted](/reference/motors/motor/set-inverted)
|
||||
* [set regulated](/reference/motors/motor/set-regulated)
|
||||
* [tank](/reference/motors/synced/tank)
|
||||
* [steer](/reference/motors/synced/steer)
|
||||
* [tacho](/reference/motors/motor/tacho)
|
||||
* [angle](/reference/motors/motor/angle)
|
||||
* [speed](/reference/motors/motor/speed)
|
||||
* [clear counts](/reference/motors/motor/clear-counts)
|
||||
* [stop all motors](/reference/motors/stop-all-motors)
|
||||
|
@ -7,19 +7,19 @@ Welcome to the **Microsoft MakeCode** editor for the **@boardname@**!
|
||||
You can program the @boardname@ using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser:
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, () => {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
|
||||
motors.largeA.setSpeed(50)
|
||||
})
|
||||
```
|
||||
```typescript
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, () => {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
|
||||
motors.largeA.setSpeed(50)
|
||||
})
|
||||
```
|
||||
|
||||
The editor work in [most modern browsers](/browsers), work [offline](/offline) once loaded and do not require any installation.
|
||||
|
||||
## [Compile and Flash: Your Program!](/device/usb)
|
||||
## Compile and Flash: Your Program!
|
||||
|
||||
When you have your code ready, you connect your @boardname@ to a computer via a USB cable
|
||||
so it appears as a mounted drive (named **EV3**).
|
||||
@ -33,7 +33,7 @@ You can run your code using the micro:bit simulator, all within the confines of
|
||||
The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.
|
||||
|
||||
```sim
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, () => {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, () => {
|
||||
motors.largeA.setSpeed(50)
|
||||
})
|
||||
```
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
```blocks
|
||||
let speed = 0;
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
if (speed < 100)
|
||||
speed = speed + 10;
|
||||
motors.largeBC.setSpeed(speed);
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
```blocks
|
||||
let speed = 0;
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
if (speed < 100)
|
||||
speed = speed + 10;
|
||||
motors.largeBC.setSpeed(speed);
|
||||
})
|
||||
sensors.touch2.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch2.onEvent(ButtonEvent.Pressed, function () {
|
||||
if (speed > -100)
|
||||
speed = speed - 10;
|
||||
motors.largeBC.setSpeed(speed);
|
||||
|
@ -17,11 +17,11 @@ function update() {
|
||||
brick.showString("speed: " + speed, 1)
|
||||
motors.largeBC.setSpeed(speed)
|
||||
}
|
||||
sensors.touch2.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch2.onEvent(ButtonEvent.Pressed, function () {
|
||||
accelerate()
|
||||
update()
|
||||
})
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
decelerate()
|
||||
update()
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Ignition Activity 1
|
||||
|
||||
```blocks
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.showImage(images.eyesDizzy)
|
||||
})
|
||||
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectDetected, function () {
|
||||
|
@ -7,7 +7,7 @@ sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Bright,
|
||||
sensors.color3.onLightChanged(LightIntensityMode.Ambient, LightCondition.Dark, function () {
|
||||
brick.showImage(images.objectsLightOn)
|
||||
})
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.showImage(images.objectsLightOn);
|
||||
})
|
||||
```
|
@ -1,12 +1,12 @@
|
||||
# Reversing the robot Activity 1
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
motors.largeBC.setSpeed(50)
|
||||
sensors.touch1.pauseUntil(TouchSensorEvent.Pressed)
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
|
||||
motors.largeBC.setSpeed(0)
|
||||
loops.pause(1000)
|
||||
brick.setLight(BrickLight.OrangeFlash)
|
||||
brick.setStatusLight(StatusLight.OrangeFlash)
|
||||
motors.largeBC.setSpeed(-50)
|
||||
loops.pause(2000)
|
||||
motors.largeBC.setSpeed(0)
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Reversing the robot Activity 2
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
sensors.touch1.pauseUntil(TouchSensorEvent.Pressed)
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
|
||||
motors.largeBC.setSpeed(50)
|
||||
sensors.touch2.pauseUntil(TouchSensorEvent.Pressed)
|
||||
sensors.touch2.pauseUntil(ButtonEvent.Pressed)
|
||||
motors.largeBC.setSpeed(0)
|
||||
loops.pause(1000)
|
||||
brick.setLight(BrickLight.OrangeFlash)
|
||||
brick.setStatusLight(StatusLight.OrangeFlash)
|
||||
motors.largeBC.setSpeed(-50)
|
||||
loops.pause(2000)
|
||||
motors.largeBC.setSpeed(0)
|
||||
|
@ -1,16 +1,16 @@
|
||||
# Reversing the robot Activity 3
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
brick.showImage(images.eyesSleeping)
|
||||
sensors.touch1.pauseUntil(TouchSensorEvent.Pressed)
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
|
||||
brick.showImage(images.eyesNeutral)
|
||||
motors.largeBC.setSpeed(50)
|
||||
sensors.touch2.pauseUntil(TouchSensorEvent.Pressed)
|
||||
sensors.touch2.pauseUntil(ButtonEvent.Pressed)
|
||||
brick.showImage(images.eyesTiredMiddle)
|
||||
motors.largeBC.setSpeed(0)
|
||||
loops.pause(1000)
|
||||
brick.setLight(BrickLight.OrangeFlash)
|
||||
brick.setStatusLight(StatusLight.OrangeFlash)
|
||||
brick.showImage(images.eyesDizzy)
|
||||
motors.largeBC.setSpeed(-50)
|
||||
loops.pause(2000)
|
||||
|
@ -2,16 +2,16 @@
|
||||
|
||||
```blocks
|
||||
let drive: number[] = []
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(1)
|
||||
})
|
||||
brick.buttonRight.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonRight.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(3)
|
||||
})
|
||||
brick.buttonUp.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonUp.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(4)
|
||||
})
|
||||
brick.buttonDown.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonDown.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(5)
|
||||
})
|
||||
pauseUntil(() => drive.length >= 5)
|
||||
|
@ -2,23 +2,23 @@
|
||||
|
||||
```blocks
|
||||
let drive: number[] = []
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(1)
|
||||
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||
})
|
||||
brick.buttonRight.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonRight.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(3)
|
||||
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||
})
|
||||
brick.buttonUp.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonUp.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(4)
|
||||
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||
})
|
||||
brick.buttonDown.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonDown.onEvent(ButtonEvent.Bumped, function () {
|
||||
drive.push(5)
|
||||
music.playSoundEffectUntilDone(sounds.systemClick)
|
||||
})
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Click);
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Bumped);
|
||||
loops.pause(1000)
|
||||
music.playSoundEffectUntilDone(sounds.communicationGo)
|
||||
for (let d of drive) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Three Point Turn Activity 1
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
motors.largeBC.tank(75, 30)
|
||||
loops.pause(1500)
|
||||
motors.largeBC.tank(-30, -75)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Three Point Turn Activity 2
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
motors.largeBC.tank(75, 30)
|
||||
loops.pause(1500)
|
||||
motors.largeBC.tank(-30, -75)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Three Point Turn Activity 3
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
motors.largeBC.tank(75, 30)
|
||||
loops.pause(1500)
|
||||
motors.largeBC.tank(-30, -75)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Traffic Lights Activity 1
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
motors.largeBC.tank(20, 20)
|
||||
sensors.color3.pauseForColor(ColorSensorColor.Red)
|
||||
motors.largeBC.tank(0, 0)
|
||||
|
@ -111,7 +111,7 @@ function stop() {
|
||||
motors.stopAllMotors()
|
||||
state = 0
|
||||
moods.knockedOut.show();
|
||||
sensors.touch3.pauseUntil(TouchSensorEvent.Pressed)
|
||||
sensors.touch3.pauseUntil(ButtonEvent.Pressed)
|
||||
moods.neutral.show();
|
||||
}
|
||||
sensors.ultrasonic4.onEvent(UltrasonicSensorEvent.ObjectNear, function () {
|
||||
|
@ -146,11 +146,11 @@ loops.forever(function () {
|
||||
}
|
||||
motors.stopAllMotors()
|
||||
st = 0;
|
||||
brick.setLight(BrickLight.RedPulse);
|
||||
brick.setStatusLight(StatusLight.RedPulse);
|
||||
brick.showImage(images.eyesKnockedOut)
|
||||
music.playSoundEffect(sounds.movementsSpeedDown)
|
||||
sensors.touch3.pauseUntil(TouchSensorEvent.Pressed)
|
||||
brick.setLight(BrickLight.Off);
|
||||
sensors.touch3.pauseUntil(ButtonEvent.Pressed)
|
||||
brick.setStatusLight(StatusLight.Off);
|
||||
})
|
||||
|
||||
// BHV
|
||||
|
@ -29,7 +29,7 @@ function DN() {
|
||||
function MNRH() {
|
||||
motors.mediumC.setBrake(true)
|
||||
brick.showImage(images.legoEv3icon)
|
||||
brick.setLight(BrickLight.OrangePulse)
|
||||
brick.setStatusLight(StatusLight.OrangePulse)
|
||||
while (!brick.buttonEnter.wasPressed()) {
|
||||
if (brick.buttonUp.wasPressed()) {
|
||||
motors.mediumC.setSpeed(-100);
|
||||
@ -41,7 +41,7 @@ function MNRH() {
|
||||
}
|
||||
motors.mediumC.stop();
|
||||
motors.mediumC.clearCounts();
|
||||
brick.setLight(BrickLight.Green);
|
||||
brick.setStatusLight(StatusLight.Green);
|
||||
}
|
||||
|
||||
function IS(t: number) {
|
||||
|
@ -11,7 +11,7 @@ function INI() {
|
||||
motors.mediumA.setSpeed(30, 1, MoveUnit.Seconds);
|
||||
motors.mediumA.setSpeed(-50, 90, MoveUnit.Degrees);
|
||||
motors.largeC.setSpeed(50)
|
||||
sensors.touch1.pauseUntil(TouchSensorEvent.Pressed);
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed);
|
||||
motors.largeC.setSpeed(-50, 0.86, MoveUnit.Rotations);
|
||||
}
|
||||
|
||||
@ -20,9 +20,9 @@ INI()
|
||||
let down = false;
|
||||
loops.forever(function () {
|
||||
brick.showImage(images.informationQuestionMark)
|
||||
brick.setLight(BrickLight.OrangePulse);
|
||||
brick.setStatusLight(StatusLight.OrangePulse);
|
||||
pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed())
|
||||
brick.setLight(BrickLight.Off)
|
||||
brick.setStatusLight(StatusLight.Off)
|
||||
music.playSoundEffect(sounds.mechanicalAirRelease)
|
||||
brick.showImage(images.informationAccept)
|
||||
if (down) {
|
||||
|
@ -11,7 +11,7 @@ function INI() {
|
||||
motors.mediumA.setSpeed(30, 1, MoveUnit.Seconds);
|
||||
motors.mediumA.setSpeed(-50, 90, MoveUnit.Degrees);
|
||||
motors.largeC.setSpeed(50)
|
||||
sensors.touch1.pauseUntil(TouchSensorEvent.Pressed);
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed);
|
||||
motors.largeC.setSpeed(-50, 0.86, MoveUnit.Rotations);
|
||||
}
|
||||
|
||||
@ -20,9 +20,9 @@ INI()
|
||||
let down = false;
|
||||
loops.forever(function () {
|
||||
brick.showImage(images.informationQuestionMark)
|
||||
brick.setLight(BrickLight.OrangePulse);
|
||||
brick.setStatusLight(StatusLight.OrangePulse);
|
||||
pauseUntil(() => (down = brick.buttonDown.wasPressed()) || brick.buttonUp.wasPressed())
|
||||
brick.setLight(BrickLight.Off)
|
||||
brick.setStatusLight(StatusLight.Off)
|
||||
music.playSoundEffect(sounds.mechanicalAirRelease)
|
||||
brick.showImage(images.informationAccept)
|
||||
if (down) {
|
||||
|
@ -146,11 +146,11 @@ loops.forever(function () {
|
||||
}
|
||||
motors.stopAllMotors()
|
||||
st = 0;
|
||||
brick.setLight(BrickLight.RedPulse);
|
||||
brick.setStatusLight(StatusLight.RedPulse);
|
||||
brick.showImage(images.eyesKnockedOut)
|
||||
music.playSoundEffect(sounds.movementsSpeedDown)
|
||||
sensors.touch3.pauseUntil(TouchSensorEvent.Pressed)
|
||||
brick.setLight(BrickLight.Off);
|
||||
sensors.touch3.pauseUntil(ButtonEvent.Pressed)
|
||||
brick.setStatusLight(StatusLight.Off);
|
||||
})
|
||||
|
||||
// BHV
|
||||
|
@ -3,10 +3,10 @@
|
||||
Use a touch sensor to make the brick happy.
|
||||
|
||||
```blocks
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.showImage(images.expressionsBigSmile)
|
||||
})
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Released, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Released, function () {
|
||||
brick.showImage(images.expressionsSick)
|
||||
})
|
||||
```
|
@ -44,7 +44,7 @@ loops.forever(function () {
|
||||
lasterror = error
|
||||
if (brick.buttonEnter.wasPressed()) {
|
||||
motors.largeBC.setSpeed(0)
|
||||
brick.buttonDown.pauseUntil(ButtonEvent.Click)
|
||||
brick.buttonDown.pauseUntil(ButtonEvent.Bumped)
|
||||
}
|
||||
})
|
||||
```
|
40
docs/examples/print-ports.md
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
# Print Ports
|
||||
|
||||
```typescript
|
||||
/**
|
||||
* Print the port states on the screen
|
||||
*/
|
||||
//% blockId=brickPrintPorts block="print ports"
|
||||
//% help=brick/print-ports
|
||||
//% weight=1 group="Screen"
|
||||
function printPorts() {
|
||||
const col = 44;
|
||||
clearScreen();
|
||||
|
||||
function scale(x: number) {
|
||||
if (Math.abs(x) > 1000) return Math.round(x / 100) / 10 + "k";
|
||||
return ("" + (x >> 0));
|
||||
}
|
||||
|
||||
// motors
|
||||
const datas = motors.getAllMotorData();
|
||||
for(let i = 0; i < datas.length; ++i) {
|
||||
const data = datas[i];
|
||||
if (!data.actualSpeed && !data.count) continue;
|
||||
const x = i * col;
|
||||
print(`${scale(data.actualSpeed)}%`, x, brick.LINE_HEIGHT)
|
||||
print(`${scale(data.count)}>`, x, 2 * brick.LINE_HEIGHT)
|
||||
print(`${scale(data.tachoCount)}|`, x, 3 * brick.LINE_HEIGHT)
|
||||
}
|
||||
|
||||
// sensors
|
||||
const sis = sensors.internal.getActiveSensors();
|
||||
for(let i =0; i < sis.length; ++i) {
|
||||
const si = sis[i];
|
||||
const x = (si.port() - 1) * col;
|
||||
const v = si._query();
|
||||
print(`${scale(v)}`, x, 9 * brick.LINE_HEIGHT)
|
||||
}
|
||||
}
|
||||
```
|
251
docs/labview.md
Normal file
@ -0,0 +1,251 @@
|
||||
# Coding in MakeCode
|
||||
|
||||
This guide is intended for users who are used to the LabView LEGO Minstorms editor.
|
||||
|
||||
## Snap the blocks
|
||||
|
||||
Just like LabView, blocks can be dragged from the cabinet and snapped together
|
||||
to create a sequence of program instructions.
|
||||
|
||||
The program below **starts**, turns on motor A, waits a second and stop motor A.
|
||||
|
||||

|
||||
|
||||
The blocks are similar: they snap on the ``||on start||`` block then latch to each other vertically.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(1000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
All block programs can be converted to JavaScript and edited from there as well.
|
||||
|
||||
```typescript
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(1000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
## Download to the EV3
|
||||
|
||||
The MakeCode editor provides a simulator to try out the code in your browser. It restarts automatically after you make a code change. Once you are ready to transfer it to the @boardname@, click the ``||Download||`` button and follow the instructions.
|
||||
|
||||
## Single motors
|
||||
|
||||
The program below controls a large motor on port A in a variety of ways: setting the speed,
|
||||
setting the speed for a given time, angle or number of rotations.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(50);
|
||||
motors.largeA.setSpeed(50, 1000, MoveUnit.MilliSeconds);
|
||||
motors.largeA.setSpeed(50, 360, MoveUnit.Degrees);
|
||||
motors.largeA.setSpeed(50, 1, MoveUnit.Rotations);
|
||||
motors.largeA.stop();
|
||||
```
|
||||
|
||||
## Steering
|
||||
|
||||
The **steering** blocks allow to synchronize two motors at a precise rate. They can also specify the duration, angle or number of rotations.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeBC.steer(0, 50);
|
||||
motors.largeBC.steer(0, 50, 1000, MoveUnit.MilliSeconds);
|
||||
motors.largeBC.steer(0, 50, 360, MoveUnit.Degrees);
|
||||
motors.largeBC.steer(0, 50, 1, MoveUnit.Rotations);
|
||||
motors.largeBC.stop();
|
||||
```
|
||||
|
||||
## Tank
|
||||
|
||||
The **tank** blocks control the speed of two motors, typically from a differential drive robot. They can also specify the duration, angle or number of rotations.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeBC.tank(50, 50);
|
||||
motors.largeBC.tank(50, 50, 1000, MoveUnit.MilliSeconds);
|
||||
motors.largeBC.tank(50, 50, 360, MoveUnit.Degrees);
|
||||
motors.largeBC.tank(50, 50, 1, MoveUnit.Rotations);
|
||||
motors.largeBC.stop();
|
||||
```
|
||||
|
||||
## Coasting and braking
|
||||
|
||||
By default, all motors coast when the move command is done. You can change this behavior with the `set brake`` block.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeD.setBrake(true);
|
||||
motors.largeD.setSpeed(50, 1, MoveUnit.Rotations)
|
||||
```
|
||||
|
||||
## Inverting and regulating motors
|
||||
|
||||
Sometime you need to invert the direction of a motor. Use the ``set invert`` block.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeA.setInverted(true);
|
||||
```
|
||||
|
||||
By default, the speed of motors is regulated. This means that if your robot goes up a hill,
|
||||
the regulator will adjust the power to match the desired speed. You can disable this feature
|
||||
using ``set regulated``.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeA.setRegulated(false);
|
||||
```
|
||||
|
||||
## Brick
|
||||
|
||||
The brick category contains a number of blocks to display graphics on the brick screen.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
brick.clearScreen()
|
||||
brick.showImage(images.expressionsWink)
|
||||
```
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
brick.setStatusLight(StatusLight.Off);
|
||||
brick.setStatusLight(StatusLight.Red);
|
||||
brick.setStatusLight(StatusLight.OrangePulse);
|
||||
```
|
||||
|
||||
## Waiting (pausing)
|
||||
|
||||
It is quite common to wait for a sensor state, such as a touch button pressed.
|
||||
The ``pause until`` blocks provide a variety of ways to acheive this.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeD.setSpeed(50)
|
||||
loops.pause(1000)
|
||||
motors.largeD.stop();
|
||||
```
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeD.setSpeed(50)
|
||||
sensors.touch1.pauseUntil(ButtonEvent.Pressed)
|
||||
motors.largeD.stop();
|
||||
```
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
motors.largeD.setSpeed(50)
|
||||
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear)
|
||||
motors.largeD.stop();
|
||||
```
|
||||
|
||||
You can also use the ``pause until`` block to wait on any boolean expression.
|
||||
The runtime will evaluate this expression until it becomes true.
|
||||
|
||||
```blocks
|
||||
motors.largeD.setSpeed(50)
|
||||
pauseUntil(() => sensors.touch1.isPressed())
|
||||
motors.largeD.stop()
|
||||
```
|
||||
|
||||
## Loops
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
loops.forever(() => {
|
||||
motors.largeD.setSpeed(50, 1, MoveUnit.Rotations);
|
||||
motors.largeD.setSpeed(-50, 1, MoveUnit.Rotations);
|
||||
})
|
||||
```
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
for(let i = 0; i < 10; i++) {
|
||||
motors.largeD.setSpeed(50, 1, MoveUnit.Rotations);
|
||||
motors.largeD.setSpeed(-50, 1, MoveUnit.Rotations);
|
||||
}
|
||||
let k = 0;
|
||||
while(k < 10) {
|
||||
motors.largeD.setSpeed(50, 1, MoveUnit.Rotations);
|
||||
motors.largeD.setSpeed(-50, 1, MoveUnit.Rotations);
|
||||
k++;
|
||||
}
|
||||
```
|
||||
|
||||
## Variables
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
let light = 0;
|
||||
loops.forever(function () {
|
||||
light = sensors.color3.light(LightIntensityMode.Reflected);
|
||||
motors.largeD.setSpeed(light)
|
||||
})
|
||||
```
|
||||
|
||||
## Concurrent loops
|
||||
|
||||
You can spin up multiple ``forever`` loops that will run at the same time.
|
||||
Only one code is running at the time, but each loop iteration will interleave.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
loops.forever(() => {
|
||||
motors.largeD.setSpeed(50, 1, MoveUnit.Rotations);
|
||||
motors.largeD.setSpeed(-50, 1, MoveUnit.Rotations);
|
||||
})
|
||||
loops.forever(() => {
|
||||
brick.showImage(images.eyesMiddleRight)
|
||||
loops.pause(1000)
|
||||
brick.showImage(images.eyesMiddleLeft)
|
||||
loops.pause(1000)
|
||||
})
|
||||
```
|
||||
|
||||
## Conditional
|
||||
|
||||
The ``if`` block allow to run different code based on a boolean condition.
|
||||
This is similar to the switch block.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
loops.forever(function() {
|
||||
if(sensors.touch1.isPressed()) {
|
||||
motors.largeD.setSpeed(50)
|
||||
} else {
|
||||
motors.largeD.stop()
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## Random
|
||||
|
||||
The ``random range`` blocks returns number between two bounds.
|
||||
|
||||

|
||||
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
motors.largeBC.steer(Math.randomRange(-5, 5), 50)
|
||||
loops.pause(100)
|
||||
})
|
||||
```
|
@ -3,7 +3,7 @@
|
||||
This program will activate an alarm when an object is lifted from the Touch Sensor.
|
||||
|
||||
```blocks
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Released, function () {
|
||||
sensors.touch1.onEvent(ButtonEvent.Released, function () {
|
||||
music.playSoundEffectUntilDone(sounds.informationActivate);
|
||||
})
|
||||
```
|
@ -2,10 +2,12 @@
|
||||
|
||||
```namespaces
|
||||
brick.showMood(moods.sleeping);
|
||||
motors.stopAllMotors()
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
[brick](/reference/brick),
|
||||
[motors](/reference/motors),
|
||||
[touch sensor](/reference/sensors/touch-sensor),
|
||||
[color sensor](/reference/sensors/color-sensor)
|
@ -9,19 +9,18 @@ brick.showString("Hello world!", 1);
|
||||
brick.showNumber(0, 1);
|
||||
brick.showValue("item", 0, 1);
|
||||
brick.clearScreen();
|
||||
brick.printPorts();
|
||||
```
|
||||
|
||||
## Buttons
|
||||
|
||||
```cards
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
|
||||
});
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Click);
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Bumped);
|
||||
brick.buttonEnter.isPressed()
|
||||
brick.buttonEnter.wasPressed()
|
||||
brick.setLight(BrickLight.Red);
|
||||
brick.setStatusLight(StatusLight.Red);
|
||||
```
|
||||
|
||||
## Other
|
||||
|
@ -22,11 +22,11 @@ loops.forever(function() {
|
||||
battery = brick.batteryLevel();
|
||||
if (battery > 15)
|
||||
{
|
||||
brick.setLight(BrickLight.Green);
|
||||
brick.setStatusLight(StatusLight.Green);
|
||||
} else if (battery > 5) {
|
||||
brick.setLight(BrickLight.Orange);
|
||||
brick.setStatusLight(StatusLight.Orange);
|
||||
} else {
|
||||
brick.setLight(BrickLight.RedPulse)
|
||||
brick.setStatusLight(StatusLight.RedPulse)
|
||||
}
|
||||
loops.pause(30000)
|
||||
})
|
||||
|
@ -34,11 +34,11 @@ Set the brick light to green when the `down` is pressed. When the button is not
|
||||
let isRed = false;
|
||||
loops.forever(function() {
|
||||
if (brick.buttonLeft.isPressed()) {
|
||||
brick.setLight(BrickLight.Green);
|
||||
brick.setStatusLight(StatusLight.Green);
|
||||
isRed = false;
|
||||
} else {
|
||||
if (!isRed) {
|
||||
brick.setLight(BrickLight.Red);
|
||||
brick.setStatusLight(StatusLight.Red);
|
||||
isRed = true;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
Run some code when a button is clicked, pressed down, or released.
|
||||
|
||||
```sig
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
|
||||
});
|
||||
```
|
||||
@ -15,8 +15,8 @@ brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
Your @boardname@ has touch sensors that work like buttons. Instead of saying `enter` or `left` as the source button, use a touch sensor block with a sensor name like `touch 1`.
|
||||
|
||||
```block
|
||||
sensors.touch1.onEvent(TouchSensorEvent.Pressed, function () {
|
||||
brick.setLight(BrickLight.Orange);
|
||||
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.setStatusLight(StatusLight.Orange);
|
||||
});
|
||||
```
|
||||
|
||||
@ -38,13 +38,13 @@ Check for event on the ENTER button. Put a message on the screen when the button
|
||||
|
||||
```blocks
|
||||
brick.showString("ENTER is: UP", 1);
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Up, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Released, function () {
|
||||
brick.showString("ENTER is: UP ", 1);
|
||||
});
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Down, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
|
||||
brick.showString("ENTER is: DOWN ", 1);
|
||||
});
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
brick.showString("ENTER was: CLICKED", 1);
|
||||
});
|
||||
```
|
||||
|
@ -3,7 +3,7 @@
|
||||
Causes your program to wait until an event at a button happens.
|
||||
|
||||
```sig
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Click);
|
||||
brick.buttonEnter.pauseUntil(ButtonEvent.Bumped);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
@ -23,7 +23,7 @@ brick.showString("We're going to wait", 1);
|
||||
brick.showString("for you to press and", 2);
|
||||
brick.showString("release the UP button", 3);
|
||||
waitTime = control.millis();
|
||||
brick.buttonUp.pauseUntil(ButtonEvent.Click);
|
||||
brick.buttonUp.pauseUntil(ButtonEvent.Bumped);
|
||||
brick.clearScreen();
|
||||
if (control.millis() - waitTime > 5000) {
|
||||
brick.showString("Ok, that took awhile!", 1)
|
||||
|
@ -33,11 +33,11 @@ Read about [touch sensors](/reference/sensors/touch-sensor) and using them as to
|
||||
Set the brick light to green if the `right` button was pressed before the `left` button. If not, the brick light is turned off when the `left` button is pressed.
|
||||
|
||||
```blocks
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Click, function() {
|
||||
brick.buttonLeft.onEvent(ButtonEvent.Bumped, function() {
|
||||
if (brick.buttonRight.wasPressed()) {
|
||||
brick.setLight(BrickLight.Green)
|
||||
brick.setStatusLight(StatusLight.Green)
|
||||
} else {
|
||||
brick.setLight(BrickLight.Off)
|
||||
brick.setStatusLight(StatusLight.Off)
|
||||
}
|
||||
})
|
||||
```
|
||||
|
@ -1,19 +0,0 @@
|
||||
# print Ports
|
||||
|
||||
Print the status of the ports on the screen.
|
||||
|
||||
```sig
|
||||
brick.printPorts();
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
Show the port status.
|
||||
|
||||
```blocks
|
||||
brick.printPorts();
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[show string](/reference/brick/show-string), [show value](/reference/brick/show-value)
|
@ -3,7 +3,7 @@
|
||||
Set the light on the brick to a solid or flashing color.
|
||||
|
||||
```sig
|
||||
brick.setLight(BrickLight.Red);
|
||||
brick.setStatusLight(StatusLight.Red);
|
||||
```
|
||||
## Parameters
|
||||
|
||||
@ -25,13 +25,13 @@ Repeatedly show a different color pattern for the brick light.
|
||||
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
brick.setLight(BrickLight.Orange)
|
||||
brick.setStatusLight(StatusLight.Orange)
|
||||
loops.pause(1000)
|
||||
brick.setLight(BrickLight.GreenFlash)
|
||||
brick.setStatusLight(StatusLight.GreenFlash)
|
||||
loops.pause(2000)
|
||||
brick.setLight(BrickLight.RedPulse)
|
||||
brick.setStatusLight(StatusLight.RedPulse)
|
||||
loops.pause(2000)
|
||||
brick.setLight(BrickLight.Off)
|
||||
brick.setStatusLight(StatusLight.Off)
|
||||
loops.pause(500)
|
||||
})
|
||||
```
|
@ -18,7 +18,7 @@ Show a greeting on the screen. Then, respond with another message when ENTER is
|
||||
```blocks
|
||||
brick.showString("Hello, I dare you to", 1);
|
||||
brick.showString("press ENTER...", 2);
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
brick.showString("Hey! Don't push my", 4);
|
||||
brick.showString("buttons.", 5);
|
||||
});
|
||||
|
@ -3,7 +3,7 @@
|
||||
Show a name-value-pair on the screen at the line you select.
|
||||
|
||||
```sig
|
||||
brick.showNumber("item", 0, 1);
|
||||
brick.showValue("item", 0, 1);
|
||||
```
|
||||
|
||||
Name-value-pairs are used to report data values to the screen. If you want to show the current temperature on the screen, you might use `"temp"` as the data name for the the value.
|
||||
@ -19,7 +19,7 @@ Name-value-pairs are used to report data values to the screen. If you want to sh
|
||||
Show the current amount of ambient light detected by sensor 2.
|
||||
|
||||
```blocks
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||
brick.buttonEnter.onEvent(ButtonEvent.Bumped, function () {
|
||||
brick.showValue("color", sensors.color2.light(LightIntensityMode.Ambient), 1)
|
||||
})
|
||||
```
|
||||
|
24
docs/reference/motors.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Motors
|
||||
|
||||
## Motion
|
||||
|
||||
```cards
|
||||
motors.largeA.setSpeed(50)
|
||||
motors.largeAB.tank(50, 50)
|
||||
motors.largeAB.steer(0, 50)
|
||||
motors.largeA.pauseUntilReady()
|
||||
motors.largeA.setBrake(false)
|
||||
motors.largeA.setInverted(true)
|
||||
motors.largeA.setRegulated(false)
|
||||
motors.largeA.stop()
|
||||
motors.largeA.reset()
|
||||
motors.stopAllMotors()
|
||||
```
|
||||
## Counters
|
||||
|
||||
```cards
|
||||
motors.largeA.speed()
|
||||
motors.largeA.angle()
|
||||
motors.largeA.tacho()
|
||||
motors.largeA.clearCounts()
|
||||
```
|
31
docs/reference/motors/motor/angle.md
Normal file
@ -0,0 +1,31 @@
|
||||
# angle
|
||||
|
||||
Get the current angle of the motor's rotation in degrees.
|
||||
|
||||
```sig
|
||||
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.
|
||||
|
||||
## 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`.
|
||||
|
||||
## Example
|
||||
|
||||
Reset the motor connected to port **A** and run it for for 2 seconds at a speed of `45`. Stop and get the current angle of rotation.
|
||||
|
||||
```blocks
|
||||
let motorAngle = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.setSpeed(45)
|
||||
loops.pause(2000)
|
||||
motors.largeA.stop()
|
||||
motorAngle = motors.largeA.angle()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[tacho](/reference/motors/motor/tacho), [speed](/reference/motors/motor/speed),
|
||||
[reset](/reference/motors/motor/reset), [clear counts](/reference/motors/motor/clear-counts)
|
35
docs/reference/motors/motor/clear-counts.md
Normal file
@ -0,0 +1,35 @@
|
||||
# clear Counts
|
||||
|
||||
Set all counters for the motor back to zero.
|
||||
|
||||
```sig
|
||||
motors.largeA.clearCounts()
|
||||
```
|
||||
|
||||
The counters for a motor are: **tacho**, **angle**, and **speed**. Each of these counters is set to start counting from `0` again. This is a way to begin new counts without having to reset the motor.
|
||||
|
||||
## Example
|
||||
|
||||
See if the motor turns the same number of times for each of two count periods. Run the motor connected to port **A** twice for 10 seconds and compare the tacho counts.
|
||||
|
||||
```blocks
|
||||
let tachoCount = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(10000)
|
||||
tachoCount = motors.largeA.tacho()
|
||||
motors.largeA.clearCounts()
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(10000)
|
||||
if (tachoCount == motors.largeA.tacho()) {
|
||||
brick.showString("Motor turns equal.", 1)
|
||||
} else {
|
||||
brick.showString("Motor turns NOT equal.", 1)
|
||||
}
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[tacho](/reference/motors/motor/tacho), [angle](/reference/motors/motor/angle),
|
||||
[speed](/reference/motors/motor/speed), [reset](/reference/motors/motor/reset)
|
30
docs/reference/motors/motor/reset.md
Normal file
@ -0,0 +1,30 @@
|
||||
# reset
|
||||
|
||||
Reset the motor's speed setting and it's counters.
|
||||
|
||||
```sig
|
||||
motors.largeA.reset()
|
||||
```
|
||||
|
||||
The motor's speed is set back to `0` and the **tacho**, **angle**, and **speed** counters are set to `0`.
|
||||
|
||||
## Example
|
||||
|
||||
See what the angle count is when a motor is stopped. Then, try it again after a reset.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Angle count:", 1)
|
||||
brick.showNumber(motors.largeA.angle(), 2)
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
motors.largeA.reset()
|
||||
brick.showString("Angle count:", 4)
|
||||
brick.showNumber(motors.largeA.angle(), 5)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[stop](/reference/motors/motor/stop), [clear counts](/reference/motors/motor/clear-counts)
|
30
docs/reference/motors/motor/set-brake.md
Normal file
@ -0,0 +1,30 @@
|
||||
# set Brake
|
||||
|
||||
Set the brake on the motor so it won't turn when it has no power.
|
||||
|
||||
```sig
|
||||
motors.largeA.setBrake(false)
|
||||
```
|
||||
|
||||
When a the motor is stopped, it can still rotate if an external force is applied to it. This can happen, for example, if your're tanking your brick on a inclined surface and stop the motors. Gravity will push down on the brick and might cause it to start rolling again. You can prevent this movement by setting the brake.
|
||||
|
||||
Also, you can use the brake to do simple skid steering for your brick.
|
||||
|
||||
## Paramters
|
||||
|
||||
* **brake**: a [boolean](/types/boolean) value which is either `true` to set the brake on or `false` to set the brake off.
|
||||
|
||||
## Example
|
||||
|
||||
Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and set the brake.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
motors.largeA.stop()
|
||||
motors.largeA.setBrake(true)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[stop](/reference/motors/motor/stop)
|
32
docs/reference/motors/motor/set-inverted.md
Normal file
@ -0,0 +1,32 @@
|
||||
# set Reversed
|
||||
|
||||
Change the direction of rotation for a motor.
|
||||
|
||||
```sig
|
||||
motors.largeA.setInverted(true)
|
||||
```
|
||||
|
||||
You use a positive value (some number greater than `0`) to drive you motor in the default direction. If you're using a motor in a way that makes more sense for your program to use a negative speed setting for that direction, you can reverse the speed range.
|
||||
|
||||
## Paramters
|
||||
|
||||
* **reversed**: a [boolean](/types/boolean) value that is `false` if the motor will use a speed value between `0` and `100` to turn in the default direction. If `true`, the motor uses a speed value between `0` and `-100` to turn in the default direction.
|
||||
|
||||
## Example
|
||||
|
||||
Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and switch the direciton of rotation. Run the motor at a speed of `-30`. Watch and see if the motor turns in the same direction as before.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
motors.largeA.stop()
|
||||
loops.pause(2000)
|
||||
motors.largeA.setInverted(true)
|
||||
motors.largeA.setSpeed(-30)
|
||||
loops.pause(2000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[stop](/reference/motors/motor/stop)
|
32
docs/reference/motors/motor/set-regulated.md
Normal file
@ -0,0 +1,32 @@
|
||||
# set Regulated
|
||||
|
||||
Tell a motor to regulate its speed or not.
|
||||
|
||||
```sig
|
||||
motors.largeA.setRegulated(true)
|
||||
```
|
||||
|
||||
In order for a motor to always rotate at a constant speed it needs regulation. This means that the motor control electronics need to continously measure how much rotation has happened. The controller takes several rotation counts for a small amount of time and compares them to see if the speed is changing. The output power is adjusted if the controller detects that the motor is running too slow or too fast.
|
||||
|
||||
If it's not regulated, your motor can change from the speed that you've set for it. Some examples are if your brick is driving forward and bumps into an object or it drives up a slope creating more load on the motor. In theses situations, if your motor speed is regulated, the controller will boost the power to the motor to keep it's speed from slowing down. Another example is when you run the motors to drive your brick down a slope. In this case, the motors would go faster than the speed you set for them if not regulated. To regulate this the controller reduces the power output to the motors to keep the brick from going faster.
|
||||
|
||||
Motor regulation is always set to **ON** when your program first starts or the motor is reset.
|
||||
|
||||
## Paramters
|
||||
|
||||
* **value**: a [boolean](/types/boolean) value which means that the motor speed is regulated if `true`. The motor speed is not regulated when this is `false`.
|
||||
|
||||
## Example
|
||||
|
||||
Turn off the speed regulation for the motor connected to port **A**.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setRegulated(false)
|
||||
motors.largeA.setSpeed(75)
|
||||
loops.pause(20000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[set speed](/reference/motors/motor/set-speed), [stop](/reference/motors/motor/stop)
|
96
docs/reference/motors/motor/set-speed.md
Normal file
@ -0,0 +1,96 @@
|
||||
# set Speed
|
||||
|
||||
Set the rotation speed of the motor as a percentage of maximum speed.
|
||||
|
||||
```sig
|
||||
motors.largeA.setSpeed(50)
|
||||
```
|
||||
|
||||
The speed setting is a pecentage of the motor's full speed. Full speed is the speed that the motor runs when the brick supplies maximum output voltage to the port.
|
||||
|
||||
If you use just the **speed** number, the motor runs continously and won't stop unless you tell it to. You can also give a value for a certain amount of distance you want the motor to rotate for. The **value** can be an amount of time, a turn angle in degrees, or a number of full rotations.
|
||||
|
||||
If you decide to use a **value** of rotation distance, you need to choose a type of movement **unit**.
|
||||
|
||||
## ~hint
|
||||
|
||||
If you use a number of milliseconds as movement units, then you don't need to include the unit type.
|
||||
|
||||
To run the motor for 500 milliseconds:
|
||||
|
||||
```block
|
||||
motors.largeA.setSpeed(50, 500)
|
||||
```
|
||||
|
||||
## ~
|
||||
|
||||
Here is how you use each different movement unit to run the motor for a fixed rotation distance.
|
||||
|
||||
```typescript
|
||||
// Run motor for 700 Milliseconds.
|
||||
motors.largeA.setSpeed(25, 700, MoveUnit.MilliSeconds);
|
||||
|
||||
// Run motor for 700 Milliseconds again but no units specified.
|
||||
motors.largeA.setSpeed(25, 700);
|
||||
|
||||
// Run the motor for 45 seconds
|
||||
motors.largeA.setSpeed(50, 45, MoveUnit.Seconds);
|
||||
|
||||
// Turn the motor for 270 degrees
|
||||
motors.largeA.setSpeed(50, 270, MoveUnit.Degrees)
|
||||
|
||||
// Turn the motor at full speed for 9 full rotations
|
||||
motors.largeA.setSpeed(100, 9, MoveUnit.Rotations);
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
* **speed**: a [number](/types/number) that is the percentage of full speed. A negative value runs the motor in the reverse direction.
|
||||
* **value**: the [number](/types/number) of movement units to rotate for. A value of `0` means run the motor continuously.
|
||||
* **unit**: the movement unit of rotation. This can be `milliseconds`, `seconds`, `degrees`, or `rotations`. If the number for **value** is `0`, this parameter isn't used.
|
||||
|
||||
## ~hint
|
||||
|
||||
** Reverse is negative speed**
|
||||
|
||||
Turning the motor in the opposite direction (reverse) is simple. Reverse is just a negative speed setting. To drive the motor in reverse at 25% speed:
|
||||
|
||||
```block
|
||||
motors.largeB.setSpeed(-25)
|
||||
```
|
||||
|
||||
## ~
|
||||
|
||||
## Examples
|
||||
|
||||
### Drive the motor for 20 seconds
|
||||
|
||||
Run the motor connected to port **A** continuously. Pause 20 seconds and then stop the motor.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(75)
|
||||
loops.pause(20000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
### Backwards motion
|
||||
|
||||
Run the motor connected to port **A** in reverse. Pause 5 seconds and then stop the motor.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(-60)
|
||||
loops.pause(5000)
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
### Run the motor for 35 rotations
|
||||
|
||||
Run the motor connected to port **B** for 35 full rotations and then stop.
|
||||
|
||||
```blocks
|
||||
motors.largeB.setSpeed(50, 35, MoveUnit.Rotations)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[tank](/reference/motors/synced/tank), [steer](/reference/motors/synced/steer), [stop](/reference/motors/motor/stop)
|
33
docs/reference/motors/motor/speed.md
Normal file
@ -0,0 +1,33 @@
|
||||
# speed
|
||||
|
||||
Get the current speed of motor rotation as a percentage of maximum speed.
|
||||
|
||||
```sig
|
||||
motors.largeA.speed()
|
||||
```
|
||||
|
||||
The actual speed of the motor is the same or very close to it's current speed setting when the motor is regulated. If not regulated, the actual speed can change from the set speed when a force, or load, is applied to it.
|
||||
|
||||
## Returns
|
||||
|
||||
* a [number](/types/number) which is the motor's current speed. This value is a percentage of maximum speed from `0` to `100`. This number is negative, like `-27`, if the direction of rotation is in reverse.
|
||||
|
||||
## Example
|
||||
|
||||
Turn speed regulation off and report the actual speed of the large motor in the forward direction. Occasionally touch the wheel on the motor to see if it changes the speed.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setRegulated(false)
|
||||
motors.largeA.setSpeed(55)
|
||||
brick.showString("Actual speed:", 1)
|
||||
for (let i = 0; i < 30; i++) {
|
||||
loops.pause(500)
|
||||
brick.showNumber(motors.largeA.speed(), 3)
|
||||
}
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[tacho](/reference/motors/motor/tacho), [speed](/reference/motors/motor/speed),
|
||||
[reset](/reference/motors/motor/reset), [clear counts](/reference/motors/motor/clear-counts)
|
25
docs/reference/motors/motor/stop.md
Normal file
@ -0,0 +1,25 @@
|
||||
# stop
|
||||
|
||||
Stop the motor.
|
||||
|
||||
```sig
|
||||
motors.largeA.stop()
|
||||
```
|
||||
|
||||
The motor stops but any motion caused from previously running the motor continues until it runs down. If you are driving your brick and then stop the motors, it will coast for awhile before stopping. If you want the brick to stop right away, use ``||motors:set brake||`` to stop it.
|
||||
|
||||
## Example
|
||||
|
||||
Run the motor connected to port **A** for 2 seconds at a speed of `30`. Stop and wait for 2 seconds, then continue at a speed of `50`.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(30)
|
||||
loops.pause(2000)
|
||||
motors.largeA.stop()
|
||||
loops.pause(2000)
|
||||
motors.largeA.setSpeed(50)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[set brake](/reference/motors/motor/set-brake), [reset](/reference/motors/motor/reset),
|
48
docs/reference/motors/motor/tacho.md
Normal file
@ -0,0 +1,48 @@
|
||||
# tacho
|
||||
|
||||
Get the current number of degress of rotation.
|
||||
|
||||
```sig
|
||||
motors.largeA.tacho()
|
||||
```
|
||||
|
||||
The motors that come with your @boardname@ have a way to detect their own turning motion. They count the amount of motor rotation in degrees. The motor will count each degree of angle rotation up to 360 degrees for a full rotation. As the motor continues to turn, the _tacho_ count keeps adding up the degrees even past one full rotation. So, if the motor makes 3 complete rotations, the count will be 1080.
|
||||
|
||||
The name _tacho_ comes from the first part of the word [tachometer](https://en.wikipedia.org/wiki/Tachometer) which is a device to measure how fast something is turning. The motor controller in the brick uses the tacho count to regulate the motor's speed.
|
||||
|
||||
## ~hint
|
||||
|
||||
**Measure RPM**
|
||||
|
||||
A standard way to know how fast a motor is turning is by measuring its _revolutions per minute_ (rpm). One revolution is the same thing as a rotation, or one turn. How do you measure rpm? Well, here's a simple way:
|
||||
|
||||
1. Record the current tacho count
|
||||
2. Run the motor for 60 seconds
|
||||
3. Get the tacho count again
|
||||
4. Subtract the first tacho count from the second one
|
||||
5. Divide that number by `360`
|
||||
|
||||
## ~
|
||||
|
||||
## Returns
|
||||
|
||||
* a [number](/types/number) which is the total count of degrees of rotation that the motor has turned since it was first started or reset.
|
||||
|
||||
## Example
|
||||
|
||||
Run the motor connected to port **A** at half speed for 5 seconds. Display the number of full rotations on the screen.
|
||||
|
||||
```blocks
|
||||
motors.largeA.setSpeed(50)
|
||||
loops.pause(5000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Motor rotations:", 1)
|
||||
brick.showNumber(motors.largeA.tacho() / 360, 3)
|
||||
motors.largeA.setSpeed(50)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[angle](/reference/motors/motor/tacho), [speed](/reference/motors/motor/speed),
|
||||
[set regulated](/reference/motors/motor/set-regulated),
|
||||
[reset](/reference/motors/motor/reset), [clear counts](/reference/motors/motor/clear-counts)
|
25
docs/reference/motors/stop-all-motors.md
Normal file
@ -0,0 +1,25 @@
|
||||
# stop All Motors
|
||||
|
||||
Stops all motors currently running on the brick.
|
||||
|
||||
```sig
|
||||
motors.stopAllMotors();
|
||||
```
|
||||
|
||||
The motors stops but any motion caused from previously running the motors continues until it runs down. If you are driving your brick and then stop the motors, it will coast for awhile before stopping.
|
||||
|
||||
## Example
|
||||
|
||||
Tank the @boardname@ forward at half speed for 5 seconds and then stop.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(50, 50);
|
||||
loops.pause(5000);
|
||||
motors.stopAllMotors();
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[stop](/reference/motors/motor/stop),
|
||||
[reset](/reference/motors/motor/reset),
|
||||
[set brake](/reference/motors/motor/set-brake)
|
84
docs/reference/motors/synced/steer.md
Normal file
@ -0,0 +1,84 @@
|
||||
# steer
|
||||
|
||||
Steer the brick in one direction using a turn ratio between two motors.
|
||||
|
||||
```sig
|
||||
motors.largeAB.steer(0, 0)
|
||||
```
|
||||
|
||||
A brick driving with two motors can steer itself by changing the speed of one motor compared to the speed of the other. To make a slow turn to the left, you might make the right motor run slightly faster than the left one. To make a fast, or sharp, turn to the right, the left motor could run at least twice as fast as the right one.
|
||||
|
||||
The @boardname@ steers by using a percentage value of _follow_ for one of the motors. This means that the motor in the turn direction will rotate slower than the other. It is the _follower_ motor and the other motor is the _drive_ motor. The drive motor runs at a percentage of full speed set in **speed**. The follower motor runs at a percentage of speed of the drive motor. So, it runs at a percentage of a percentage of full speed.
|
||||
|
||||
To make the turn happen you give a _turn ratio_ which is a percentage value of steer to the left or right. If you want to steer to the left at 30% of the of the drive motor speed, use the value of `-30` for **turnRatio**. Left turns use negative values and right turns use positive values. A really sharp turn to the right might use a turn ratio value of `80`.
|
||||
|
||||
## Speed and distance
|
||||
|
||||
The speed setting is a pecentage of the motor's full speed. Full speed is the speed that the motors run when the brick supplies maximum output voltage to the port.
|
||||
|
||||
If you use just the **speed** number, the motors run continously and won't stop unless you tell them to. You can also give a value for a certain amount of distance you want the motors to rotate for. The **value** can be an amount of time, a turn angle in degrees, or a number of full rotations.
|
||||
|
||||
If you decide to use a **value** of rotation distance, you need to choose a type of movement **unit**. Also, if you use a number of milliseconds as movement units, then you don't need to include the unit type. The description in [set speed](/reference/motors/motor/set-speed) shows how to use different movement units.
|
||||
|
||||
## Parameters
|
||||
|
||||
* **turnRatio**: a [number](/types/number) that is the percentage of speed of the drive motor. The follower motor runs at this speed. A negative number steers to the left and a positive number steers to the right. This is a number between `-100` and `100`.
|
||||
* **speed**: a [number](/types/number) that is the percentage of full speed. A negative value runs the motors in the reverse direction. This is the speed that the drive motor runs at.
|
||||
* **value**: the [number](/types/number) of movement units to rotate for. A value of `0` means run the motor continuously.
|
||||
* **unit**: the movement unit of rotation. This can be `milliseconds`, `seconds`, `degrees`, or `rotations`. If the number for **value** is `0`, this parameter isn't used.
|
||||
|
||||
## ~hint
|
||||
|
||||
** Reverse is negative speed**
|
||||
|
||||
Steering the brick backwards (in reverse) is simple. Reverse is just a negative speed setting. To steer the brick to the left in reverse at 75% speed:
|
||||
|
||||
```block
|
||||
motors.largeBC.steer(-15, -75)
|
||||
```
|
||||
|
||||
## ~
|
||||
|
||||
## Examples
|
||||
|
||||
### Make a slight right
|
||||
|
||||
Turn to the right with a turn ratio of 10%.
|
||||
|
||||
```block
|
||||
motors.largeBC.steer(10, 55)
|
||||
```
|
||||
|
||||
### Make a sharp left
|
||||
|
||||
Turn sharply to the left.
|
||||
|
||||
```block
|
||||
motors.largeBC.steer(-80, 40)
|
||||
```
|
||||
|
||||
### Steer straight
|
||||
|
||||
Use **steer** but go straight ahead.
|
||||
|
||||
```block
|
||||
motors.largeBC.steer(0, 100)
|
||||
```
|
||||
|
||||
### Sneaky snake
|
||||
|
||||
Steer the brick in a snake pattern for a short time.
|
||||
|
||||
```block
|
||||
for (let i = 0; i < 4; i++) {
|
||||
motors.largeBC.steer(30, 30)
|
||||
loops.pause(5000)
|
||||
motors.largeBC.steer(-30, 30)
|
||||
loops.pause(5000)
|
||||
}
|
||||
motors.stopAllMotors()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[tank](/reference/motors/synced/tank), [set speed](/reference/motors/motor/set-speed)
|
81
docs/reference/motors/synced/tank.md
Normal file
@ -0,0 +1,81 @@
|
||||
# tank
|
||||
|
||||
Rotate two motors in synchronization.
|
||||
|
||||
```sig
|
||||
motors.largeAB.tank(50, 50)
|
||||
```
|
||||
|
||||
Tanking the brick will drive two motors in synchronization. This means that both motors will start at the same time. Also, each motor uses the same amount of rotation when running at the same speed. You can use different speed values for each motor to perform turns or spins.
|
||||
|
||||
## Speed and distance
|
||||
|
||||
The speed setting is a pecentage of the motor's full speed. Full speed is the speed that the motors run when the brick supplies maximum output voltage to the port.
|
||||
|
||||
If you use just the **speed** number, the motors run continously and won't stop unless you tell them to. You can also give a value for a certain amount of distance you want the motors to rotate for. The **value** can be an amount of time, a turn angle in degrees, or a number of full rotations.
|
||||
|
||||
If you decide to use a **value** of rotation distance, you need to choose a type of movement **unit**. Also, if you use a number of milliseconds as movement units, then you don't need to include the unit type. The description in [set speed](/reference/motors/motor/set-speed) shows how to use different movement units.
|
||||
|
||||
## Parameters
|
||||
|
||||
* **speedLeft**: a [number](/types/number) that is the percentage of full speed for the motor attached to the left of the brick. A negative value runs the motor in the reverse direction.
|
||||
* **speedRight**: a [number](/types/number) that is the percentage of full speed for the motor attached to the right of the brick. A negative value runs the motor in the reverse direction.
|
||||
* **value**: the [number](/types/number) of movement units to rotate for. A value of `0` means run the motor continuously.
|
||||
* **unit**: the movement unit of rotation. This can be `milliseconds`, `seconds`, `degrees`, or `rotations`. If the number for **value** is `0`, this parameter isn't used.
|
||||
|
||||
## ~hint
|
||||
|
||||
** Reverse is negative speed**
|
||||
|
||||
Tankng the brick in the opposite direction (reverse) is simple. Reverse is just a negative speed setting. To drive the motors in reverse at 75% speed:
|
||||
|
||||
```block
|
||||
motors.largeBC.tank(-75, -75)
|
||||
```
|
||||
|
||||
## ~
|
||||
|
||||
## Examples
|
||||
|
||||
### Tank forward and backward
|
||||
|
||||
Move the brick straight ahead and then go backward.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(75, 75)
|
||||
loops.pause(10000)
|
||||
motors.largeAB.tank(-55, -55)
|
||||
loops.pause(10000)
|
||||
motors.stopAllMotors()
|
||||
```
|
||||
|
||||
### Slip steer
|
||||
|
||||
Run the right motor at 50% and let the left motor spin freely.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(0, 50)
|
||||
```
|
||||
|
||||
### Skid steer
|
||||
|
||||
Set the brake on the right motor. Run the left motor at 60% and let the right motor skid.
|
||||
|
||||
```blocks
|
||||
motors.largeB.setBrake(true)
|
||||
motors.largeAB.tank(60, 0)
|
||||
```
|
||||
|
||||
### Spin around
|
||||
|
||||
Run both motors in opposite directions to spin the brick around to the left.
|
||||
|
||||
```blocks
|
||||
motors.largeAB.tank(-30, 30)
|
||||
loops.pause(5000)
|
||||
motors.stopAllMotors()
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[steer](/reference/motors/synced/steer), [set speed](/reference/motors/motor/set-speed)
|
BIN
docs/static/configurations/chrome-version.png
vendored
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
docs/static/configurations/edge-version.png
vendored
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
docs/static/configurations/firefox-version.png
vendored
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
docs/static/configurations/ie-version.png
vendored
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/static/configurations/osx-version.png
vendored
Normal file
After Width: | Height: | Size: 128 KiB |
BIN
docs/static/configurations/safari-version.png
vendored
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
docs/static/configurations/windows-version.png
vendored
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
docs/static/labview/brake.png
vendored
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
docs/static/labview/brickimage.png
vendored
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
docs/static/labview/brickstatuslight.png
vendored
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
docs/static/labview/ife.png
vendored
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
docs/static/labview/invertmotor.png
vendored
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
docs/static/labview/lighttospeed.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
docs/static/labview/loopinfinite.PNG
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
docs/static/labview/motors.png
vendored
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/static/labview/multipleloops.png
vendored
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
docs/static/labview/pausefordistance.png
vendored
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
docs/static/labview/pausefortime.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
docs/static/labview/pausefortouch.png
vendored
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
docs/static/labview/random.png
vendored
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
docs/static/labview/sequencing.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
docs/static/labview/speedoflight.png
vendored
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
docs/static/labview/speedoflightvar.png
vendored
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/static/labview/steer.png
vendored
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
docs/static/labview/tank.png
vendored
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
docs/static/labview/unregulatedmotor.png
vendored
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
docs/static/labview/while.png
vendored
Normal file
After Width: | Height: | Size: 26 KiB |
209
docs/static/lego-logo-white.svg
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
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"
|
||||
id="svg10"
|
||||
width="236.9"
|
||||
height="56.7"
|
||||
version="1.1"
|
||||
sodipodi:docname="lego-logo-white.svg"
|
||||
inkscape:export-filename="C:\gh\pxt-ev3\docs\static\lego_education_logo_white.png"
|
||||
inkscape:export-xdpi="138.33701"
|
||||
inkscape:export-ydpi="138.33701"
|
||||
inkscape:version="0.92.1 r15371">
|
||||
<metadata
|
||||
id="metadata54">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1600"
|
||||
inkscape:window-height="837"
|
||||
id="namedview52"
|
||||
showgrid="false"
|
||||
inkscape:zoom="4.8374843"
|
||||
inkscape:cx="118.45"
|
||||
inkscape:cy="28.35"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg10" />
|
||||
<defs
|
||||
id="defs14">
|
||||
<clipPath
|
||||
id="clipPath26">
|
||||
<path
|
||||
d="M332 275.6h177.7v42.5H332z"
|
||||
id="path24" />
|
||||
</clipPath>
|
||||
<clipPath
|
||||
id="clipPath76">
|
||||
<path
|
||||
d="M332 275.6h177.7v42.5H332z"
|
||||
id="path74" />
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g
|
||||
id="g18"
|
||||
transform="matrix(1.33333 0 0 -1.33333 0 56.7)"
|
||||
inkscape:export-xdpi="138.33701"
|
||||
inkscape:export-ydpi="138.33701">
|
||||
<g
|
||||
id="g130"
|
||||
transform="translate(-332 -275.6)">
|
||||
<g
|
||||
id="g20">
|
||||
<g
|
||||
clip-path="url(#clipPath26)"
|
||||
id="g22">
|
||||
<g
|
||||
transform="translate(387.6 297.7)"
|
||||
id="g28">
|
||||
<path
|
||||
id="path30"
|
||||
d="M0 0h6.3c0 1.4-.2 2.2-.5 2.6-.4.3-1.3.5-2.7.5C1.7 3 .8 2.9.5 2.5.2 2 0 1.3 0 0m6.3-4.1h3.4c0-2-.6-3.3-1.8-4-.8-.4-2.4-.6-4.8-.6-2.6 0-4.4.5-5.3 1.6-.8 1-1.2 2.8-1.2 5.5S-3 3-2.2 4C-1.4 5.1.4 5.7 3 5.7 6 5.7 7.8 5 8.6 4c.7-1 1.1-3 1.1-6.2H0c0-1.7.1-2.7.4-3.2.4-.6 1.3-.8 2.7-.8 1.2 0 2 0 2.3.2.6.3 1 .9 1 1.8"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(406.4 300.7)"
|
||||
id="g32">
|
||||
<path
|
||||
id="path34"
|
||||
d="M0 0c-1.4 0-2.2-.4-2.6-1.1a7 7 0 0 1-.5-3c0-2 .2-3.3.4-3.8.4-.9 1.3-1.3 2.7-1.3 1.6 0 2.6.4 3 1.2.3.6.4 1.8.4 3.8a7 7 0 0 1-.5 3.1C2.4-.4 1.5 0 0 0m3.4-11.7v2.2C2.7-11 1.2-11.8-1-11.8c-2.4 0-4 .7-4.7 2.2-.5 1-.7 2.7-.7 5.4 0 2.3.3 4 .9 5C-4.8 2-3.3 2.5-1 2.5s3.7-.7 4.2-2h.2v7.9h3.3v-20.2z"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(428.8 289)"
|
||||
id="g36">
|
||||
<path
|
||||
id="path38"
|
||||
d="M0 0h-3.3v2.2C-4 .6-5.6-.1-7.9-.1c-3.2 0-4.8 1.3-4.8 4v10.2h3.4V5.2c0-1 .1-1.8.4-2.1.3-.4 1-.7 2-.7 1.2 0 2.1.3 2.6.9.5.5.8 1.4.8 2.7v8H0z"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(441 294.4)"
|
||||
id="g40">
|
||||
<path
|
||||
id="path42"
|
||||
d="M0 0h3.4c0-2.3-.5-3.8-1.6-4.6-.8-.6-2.4-1-4.8-1-2.7 0-4.4.6-5.2 1.7-.8 1-1.1 2.8-1.1 5.6 0 2.7.3 4.5 1 5.4C-7.3 8.3-5.6 9-3 9c2.3 0 3.9-.3 4.8-1 1-.6 1.6-2 1.6-4.1H0c0 1-.2 1.8-.7 2-.4.4-1.2.5-2.3.5-1.4 0-2.3-.3-2.6-1-.2-.5-.4-1.7-.4-3.6 0-2 .1-3.2.4-3.6.3-.7 1.2-1 2.6-1 1.3 0 2 .1 2.4.5.4.3.6 1.1.6 2.4"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(452.8 295.4)"
|
||||
id="g44">
|
||||
<path
|
||||
id="path46"
|
||||
d="M0 0c-1.1 0-1.8 0-2.2-.2-.6-.3-1-1-1-1.8 0-1 .3-1.6.8-1.8.4-.3 1.2-.4 2.4-.4 1.1 0 1.8.1 2.2.3.6.3 1 1 1 1.9 0 .9-.4 1.4-1 1.7A6 6 0 0 1 0 0m3.1-6.3l.1 1.7c-.3-.8-1-1.3-1.9-1.6-.5-.2-1.4-.3-2.5-.3-1.8 0-3.1.3-4 .9C-6-5-6.4-3.8-6.4-2-6.5-.3-6 .8-5 1.5c.7.5 2 .8 3.8.8 1.1 0 2 0 2.5-.2C2 1.8 2.7 1.4 3 .7h.1v1.8c0 1.2-.1 2-.4 2.4-.4.5-1.3.7-2.6.7-.9 0-1.5 0-1.9-.3-.5-.3-.7-.8-.7-1.7H-6c0 1.9.6 3.1 1.8 3.7.8.4 2.2.6 4.2.6 2.4 0 4-.3 4.9-1 1-.7 1.5-2.2 1.5-4.4v-8.8z"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(460.9 300.6)"
|
||||
id="g48">
|
||||
<path
|
||||
id="path50"
|
||||
d="M0 0v2.6h1.8v3.2H5V2.6h5.5V0H5v-7.2c0-.7 0-1.2.2-1.4.2-.3.6-.5 1.3-.5.8 0 1.3.3 1.5 1l.2 2h3c0-2-.3-3.4-.8-4.2-.7-.9-2-1.4-3.9-1.4-1.8 0-3 .3-3.7.9-.8.6-1.1 1.8-1.1 3.6V0z"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<path
|
||||
id="path52"
|
||||
d="M478.2 289h-3.4v14.2h3.4zm0 17.3h-3.4v3h3.4z"
|
||||
fill="#fff" />
|
||||
<g
|
||||
transform="translate(487.5 300.7)"
|
||||
id="g54">
|
||||
<path
|
||||
id="path56"
|
||||
d="M0 0c-1.4 0-2.4-.3-2.8-1-.3-.4-.5-1.7-.5-3.6 0-2 .2-3.2.5-3.7.4-.6 1.3-1 2.8-1 1.5 0 2.4.4 2.8 1 .3.5.5 1.7.5 3.7S3-1.4 2.8-1C2.4-.3 1.5 0 0 0m0 2.6C2.8 2.6 4.7 2 5.5 1c.8-.9 1.1-2.7 1.1-5.6 0-2.9-.3-4.8-1-5.6-1-1-2.8-1.6-5.6-1.6s-4.7.5-5.5 1.6c-.8.8-1.1 2.7-1.1 5.6 0 2.9.3 4.7 1 5.6 1 1 2.8 1.6 5.6 1.6"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(497 303.2)"
|
||||
id="g58">
|
||||
<path
|
||||
id="path60"
|
||||
d="M0 0h3.4v-2.1A3 3 0 0 0 5.3-.2C6 0 6.7 0 8 0c1.8 0 3-.3 3.8-1 .7-.9 1-2.1 1-4v-9H9.4v9c0 1-.2 1.7-.6 2-.3.5-1 .7-2 .7-1.4 0-2.4-.4-2.8-1-.4-.6-.6-1.5-.6-3V-14H0z"
|
||||
fill="#fff" />
|
||||
</g>
|
||||
<path
|
||||
id="path62"
|
||||
d="M384.5 316.4h125.2v1.7H384.5z"
|
||||
fill="#006cb6" />
|
||||
<path
|
||||
id="path64"
|
||||
d="M384.5 275.6H471v1.7h-86.5z"
|
||||
fill="#006cb6" />
|
||||
<path
|
||||
id="path66"
|
||||
d="M482.3 275.6h27.4v1.7h-27.4z"
|
||||
fill="#006cb6" />
|
||||
</g>
|
||||
</g>
|
||||
<path
|
||||
id="path68"
|
||||
d="M332.3 275.9h42v42h-42z"
|
||||
fill="#fff" />
|
||||
<g
|
||||
id="g70">
|
||||
<g
|
||||
clip-path="url(#clipPath76)"
|
||||
id="g72">
|
||||
<g
|
||||
transform="translate(371.5 300.4)"
|
||||
id="g78">
|
||||
<path
|
||||
id="path80"
|
||||
d="M0 0c0-1.3-.5-3-.9-4C-2.3-8.4-4-11.1-8-11.1c-1.2 0-3.2.3-4 2.4l-.2.5-.3-.5a6.5 6.5 0 0 0-5-2.4c-1.6 0-2.8.5-3.6 1.4l-.2.3-.2-.3c-.8-.9-2.3-1.4-4-1.4-1.4 0-2.5.4-3.3 1.3l-.2.2-.2-.2c-.8-.9-2.2-1.3-3.9-1.3-2 0-3.2 1.2-3.3 3 0 3 2.7 9 3.9 10.8a3.4 3.4 0 0 0 3.1 1.8c1 0 1.6-.2 2-.6.3-.4.4-.7.4-1.4v-1l.5.9c1.2 2 3.3 2.2 5.3 2.2 1.3 0 2.6-.5 3-1.3l.2-.3.3.2a6 6 0 0 0 4 1.4c1.8 0 3.1-.5 3.9-1.3l.4-.7.2-.4.3.3c1.1 1.4 2.6 2 4.5 2 1.5 0 2.6-.4 3.4-1.2C0 2.3 0 1 0 0m-39.2-24.5h42v42h-42z"
|
||||
fill="#ffed00" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(372.7 298.8)"
|
||||
id="g82">
|
||||
<path
|
||||
id="path84"
|
||||
d="M0 0a24 24 0 0 0-1.8-5.5c-1.4-3-3.4-5.3-7.2-5.3-2 0-3.7.6-4.7 1.8a7.6 7.6 0 0 0-5-1.9 6 6 0 0 0-3.8 1.2 7.3 7.3 0 0 0-7.7 0 7 7 0 0 0-4-1.1C-37-10.8-39-9-39-6.5c0 3.3 2.7 9.4 4 11.5a5 5 0 0 0 4.4 2.4c2 0 2.7-.5 3-1.3 1.6 1.4 3.6 1.4 5 1.4 1.7 0 2.7-.4 3.5-1 1.2.6 2.6 1 4.2 1 2 0 3.6-.5 4.7-1.5a7 7 0 0 0 4.6 1.5c2.3 0 3.8-.9 4.7-2.1C.5 3.6.2 1.9 0 0m-40.3-22.9h42v42h-42z"
|
||||
fill="#e20614" />
|
||||
</g>
|
||||
<path
|
||||
id="path86"
|
||||
d="M374 276.2h-41.4v41.3H374zm-42-.6h42.6v42.5H332z"
|
||||
fill="#1c1c1b" />
|
||||
<g
|
||||
transform="translate(372.7 306.3)"
|
||||
id="g88">
|
||||
<path
|
||||
id="path90"
|
||||
d="M0 0a1 1 0 0 1-1-1c0-.6.4-1 1-1s1 .4 1 1C1-.5.6 0 0 0m0-.2a.8.8 0 1 0 0-1.6.8.8 0 0 0 0 1.6m.5-1.4l-.1.3-.2.2.3.3c0 .2-.2.3-.4.3h-.5v-1h.2v.4H0l.2-.3v-.2zm-.7.7v.2H0l.2-.1L0-.9z"
|
||||
fill="#1c1c1b" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(367.4 300.5)"
|
||||
id="g92">
|
||||
<path
|
||||
id="path94"
|
||||
d="M0 0c0-1-1.6-5.4-2.2-6.4-.2-.4-.5-.7-1-.7s-.6.3-.7.6c0 1 1.8 6 2.4 6.7.3.4.6.5 1 .5C0 .7 0 .3 0 0m2.9-1.8c-.4-1.8-1.2-3.9-2-5.5-1.5-2.6-3.2-3-4.8-3-1.5 0-3.2.7-3.2 3 0 1.7.7 4 1.3 5.7 1 2.8 2.2 5.1 5.7 5 4 0 3.3-3.6 3-5.2m-13 2.5c-.5 0-.9-.3-1.2-.7-.6-1-2-4.5-2.2-6-.1-1 .3-1.1.8-1.1.7 0 1.6.8 1.9 2.1 0 0-1.5 0-1 1.3.3 1.3 1 1.5 2.2 1.6 2.4 0 2.2-1.7 2-2.6-.6-3-2.8-5.5-5.9-5.5-2 0-3.4 1.1-3.4 3.3 0 1.5.8 3.9 1.4 5.3 1.3 3 2.6 5 6 5 2 0 3.7-.7 3.5-2.6-.2-1.4-1-2.2-2.2-2.3-.4 0-1.8 0-1.3 1.4.1.5.2.8-.5.8m-10.7-5.2l-.6-2a7 7 0 0 0 2 .2c1.1 0 1.8-.4 1.8-1.3 0-2-2.3-2.6-3.9-2.6-1.7 0-3.2 1-3.2 2.8A21 21 0 0 0-22.3.4c1.4 2.8 2.8 3.1 5.2 3.1 1.1 0 2.3-.4 2.3-1.4 0-1.4-1.2-2-2.3-2H-19s-.4-.6-.8-1.7c2.2.3 3.1-.2 2.8-1.5-.5-1.7-2-1.8-3.8-1.4m-7-2c2.2.4 2.7-.4 2.6-1.1-.2-2.2-2.1-2.6-3.8-2.6-1.2 0-2.3.6-2.4 2 0 2.5 2.5 8.3 3.7 10.2.6 1 1.3 1.4 2.3 1.4 1 0 1.3-.5 1.3-1.1 0-1.7-2.8-6.8-3.6-8.8M-.3 4.7a6 6 0 0 1-4.7-2l-.5.7c-.9 1-2.2 1.4-4 1.4-1.8 0-3.3-.6-4.3-1.4-.5.8-1.8 1.4-3.3 1.4-2 0-4.2-.3-5.5-2.4 0 .8-.1 1.2-.5 1.6-.6.6-1.4.7-2.2.7-1.5 0-2.6-.6-3.4-2-1.1-1.8-4-7.9-3.9-10.8 0-2 1.3-3.3 3.6-3.4 1.8 0 3.2.5 4.1 1.4.8-.9 2-1.4 3.5-1.4 1.6 0 3.2.5 4.2 1.6.8-1 2.1-1.6 3.8-1.6 2.1 0 4 1 5.2 2.6.7-1.9 2.4-2.6 4.3-2.6 4.1 0 6 2.8 7.4 7.3.4 1 .8 2.7.9 4.1.1 2.4-.9 4.8-4.7 4.8"
|
||||
fill="#1c1c1b" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 9.6 KiB |
BIN
docs/static/lego_education_logo_white.png
vendored
Normal file
After Width: | Height: | Size: 9.1 KiB |
@ -77,7 +77,7 @@ export function deployCoreAsync(resp: pxtc.CompileResult, isCli = false) {
|
||||
let rbfBIN = pxt.U.fromHex(rbfHex)
|
||||
pxt.HF2.write16(rbfBIN, 4, rbfBIN.length)
|
||||
|
||||
let origElfUF2 = UF2.parseFile(pxt.U.stringToUint8Array(atob(resp.outfiles[pxt.outputName()])))
|
||||
let origElfUF2 = UF2.parseFile(pxt.U.stringToUint8Array(ts.pxtc.decodeBase64(resp.outfiles[pxt.outputName()])))
|
||||
|
||||
let mkFile = (ext: string, data: Uint8Array = null) => {
|
||||
let f = UF2.newBlockFile()
|
||||
|
@ -41,8 +41,7 @@ export class FieldSpeed extends Blockly.FieldSlider implements Blockly.FieldCust
|
||||
this.speedSVG = document.createElementNS("http://www.w3.org/2000/svg", "svg") as SVGGElement;
|
||||
pxsim.svg.hydrate(this.speedSVG, {
|
||||
viewBox: "0 0 200 100",
|
||||
width: "200",
|
||||
height: "100"
|
||||
width: "170"
|
||||
});
|
||||
|
||||
labelContainer.appendChild(this.speedSVG);
|
||||
|
@ -4,7 +4,7 @@
|
||||
export NVM_DIR="/home/dotnet-bot/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
||||
|
||||
nvm install 5
|
||||
nvm install 8
|
||||
|
||||
# Set up build environment variables
|
||||
echo ---------- Setting build environment variables
|
||||
|
@ -1,26 +0,0 @@
|
||||
{
|
||||
"automation": "Automation, process control and robotic controllers",
|
||||
"automation.Behavior": "A behavior",
|
||||
"automation.Behavior.update": "Called on each behavior iteration even for suppresed behaviors",
|
||||
"automation.Behavior.update|param|elapsed": "milli seconds since last call",
|
||||
"automation.BehaviorManager": "A manager for behaviors",
|
||||
"automation.BehaviorManager.add": "Adds a new behavior to the behavior manager",
|
||||
"automation.BehaviorManager.add|param|behavior": "the behavior to add",
|
||||
"automation.BehaviorManager.start": "Starts the behavior control loop",
|
||||
"automation.BehaviorManager.stop": "Stops the execution loop",
|
||||
"automation.PIDController": "A PID controller.\n* Reference: Feedback System, Karl Johan Astrom & Rickard M. Murry",
|
||||
"automation.PIDController.compute": "Computes the output based on the system state",
|
||||
"automation.PIDController.setControlSaturation": "Sets the control saturation values",
|
||||
"automation.PIDController.setControlSaturation|param|high": "highest control value, eg: 100",
|
||||
"automation.PIDController.setControlSaturation|param|low": "lowest control value, eg: -100",
|
||||
"automation.PIDController.setDerivativeFilter": "Sets the derivative filter gain",
|
||||
"automation.PIDController.setDerivativeFilter|param|N": "the filter gain, eg:10",
|
||||
"automation.PIDController.setGains": "Sets the PID gains",
|
||||
"automation.PIDController.setGains|param|b": "setpoint weight, eg: 0.9",
|
||||
"automation.PIDController.setGains|param|kd": "derivative gain",
|
||||
"automation.PIDController.setGains|param|ki": "integral gain",
|
||||
"automation.PIDController.setGains|param|kp": "proportional gain",
|
||||
"automation.PIDController.setPoint": "Updates the desired setpoint",
|
||||
"automation.addBehavior": "Adds the behavior and starts it",
|
||||
"automation.addBehavior|param|behavior": "a behavior"
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"automation.PIDController.compute|block": "%pid|compute for timestep %timestep|(ms) at state %y",
|
||||
"automation.PIDController.setControlSaturation|block": "set %pid|control saturation from %low|to %high",
|
||||
"automation.PIDController.setDerivativeFilter|block": "set %pid|derivative filter %N",
|
||||
"automation.PIDController.setGains|block": "set %pid|gains kp %kp|ki %ki|kd %kd",
|
||||
"automation.PIDController.setPoint|block": "set %pid|point to %ysp",
|
||||
"automation.addBehavior|block": "add behavior %behavior",
|
||||
"automation|block": "automation",
|
||||
"{id:category}Automation": "Automation",
|
||||
"{id:group}Behaviors": "Behaviors",
|
||||
"{id:group}PID": "PID"
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
{
|
||||
"Array": "Add, remove, and replace items in lists.\n\nAdd, remove, and replace items in lists.",
|
||||
"Array.filter": "Return the elements of an array that meet the condition specified in a callback function.",
|
||||
"Array.filter|param|callbackfn": "A function that accepts up to two arguments. The filter method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.get": "Get the value at a particular index",
|
||||
"Array.get|param|index": "the zero-based position in the list of the item, eg: 0",
|
||||
"Array.indexOf": "Return the index of the first occurrence of a value in an array.",
|
||||
"Array.indexOf|param|fromIndex": "The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.",
|
||||
"Array.indexOf|param|item": "The value to locate in the array.",
|
||||
"Array.insertAt": "Insert the value at a particular index, increases length by 1",
|
||||
"Array.insertAt|param|index": "the zero-based position in the list to insert the value, eg: 0",
|
||||
"Array.length": "Get or set the length of an array. This number is one more than the index of the last element the array.",
|
||||
"Array.map": "Call a defined callback function on each element of an array, and return an array containing the results.",
|
||||
"Array.map|param|callbackfn": "A function that accepts up to two arguments. The map method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.pop": "Remove the last element from an array and return it.",
|
||||
"Array.push": "Append a new element to an array.",
|
||||
"Array.reduce": "Call the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
|
||||
"Array.reduce|param|callbackfn": "A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the array.",
|
||||
"Array.reduce|param|initialValue": "Initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.",
|
||||
"Array.removeAt": "Remove the element at a certain index.",
|
||||
"Array.removeElement": "Remove the first occurence of an object. Returns true if removed.",
|
||||
"Array.reverse": "Reverse the elements in an array. The first array element becomes the last, and the last array element becomes the first.",
|
||||
"Array.set": "Store a value at a particular index",
|
||||
"Array.set|param|index": "the zero-based position in the list to store the value, eg: 0",
|
||||
"Array.shift": "Remove the first element from an array and return it. This method changes the length of the array.",
|
||||
"Array.slice": "Return a section of an array.",
|
||||
"Array.slice|param|end": "The end of the specified portion of the array. eg: 0",
|
||||
"Array.slice|param|start": "The beginning of the specified portion of the array. eg: 0",
|
||||
"Array.sort": "Sort the elements of an array in place and returns the array. The sort is not necessarily stable.",
|
||||
"Array.splice": "Remove elements from an array.",
|
||||
"Array.splice|param|deleteCount": "The number of elements to remove. eg: 0",
|
||||
"Array.splice|param|start": "The zero-based location in the array from which to start removing elements. eg: 0",
|
||||
"Array.unshift": "Add one element to the beginning of an array and return the new length of the array.",
|
||||
"Boolean.toString": "Returns a string representation of an object.",
|
||||
"Buffer.fill": "Fill (a fragment) of the buffer with given value.",
|
||||
"Buffer.getNumber": "Read a number in specified format from the buffer.",
|
||||
"Buffer.length": "Returns the length of a Buffer object.",
|
||||
"Buffer.rotate": "Rotate buffer left in place.\n\n\n\nstart. eg: -1",
|
||||
"Buffer.rotate|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
|
||||
"Buffer.rotate|param|offset": "number of bytes to shift; use negative value to shift right",
|
||||
"Buffer.rotate|param|start": "start offset in buffer. Default is 0.",
|
||||
"Buffer.setNumber": "Write a number in specified format in the buffer.",
|
||||
"Buffer.shift": "Shift buffer left in place, with zero padding.\n\n\n\nstart. eg: -1",
|
||||
"Buffer.shift|param|length": "number of elements in buffer. If negative, length is set as the buffer length minus",
|
||||
"Buffer.shift|param|offset": "number of bytes to shift; use negative value to shift right",
|
||||
"Buffer.shift|param|start": "start offset in buffer. Default is 0.",
|
||||
"Buffer.slice": "Return a copy of a fragment of a buffer.",
|
||||
"Buffer.toHex": "Convert a buffer to its hexadecimal representation.",
|
||||
"Buffer.write": "Write contents of `src` at `dstOffset` in current buffer.",
|
||||
"Math": "More complex operations with numbers.",
|
||||
"Math.abs": "Returns the absolute value of a number (the value without regard to whether it is positive or negative).\nFor example, the absolute value of -5 is the same as the absolute value of 5.",
|
||||
"Math.abs|param|x": "A numeric expression for which the absolute value is needed.",
|
||||
"Math.acos": "Returns the arccosine (in radians) of a number",
|
||||
"Math.acos|param|x": "A number",
|
||||
"Math.asin": "Returns the arcsine (in radians) of a number",
|
||||
"Math.asin|param|x": "A number",
|
||||
"Math.atan": "Returns the arctangent (in radians) of a number",
|
||||
"Math.atan2": "Returns the arctangent of the quotient of its arguments.",
|
||||
"Math.atan2|param|x": "A number",
|
||||
"Math.atan2|param|y": "A number",
|
||||
"Math.atan|param|x": "A number",
|
||||
"Math.ceil": "Returns the smallest number greater than or equal to its numeric argument.",
|
||||
"Math.ceil|param|x": "A numeric expression.",
|
||||
"Math.constrain": "Constrains a number to be within a range",
|
||||
"Math.cos": "Returns the cosine of a number.",
|
||||
"Math.cos|param|x": "An angle in radians",
|
||||
"Math.exp": "Returns returns ``e^x``.",
|
||||
"Math.exp|param|x": "A number",
|
||||
"Math.floor": "Returns the greatest number less than or equal to its numeric argument.",
|
||||
"Math.floor|param|x": "A numeric expression.",
|
||||
"Math.icos": "Returns the cosine of an input angle. This is an 8-bit approximation.",
|
||||
"Math.icos|param|theta": "input angle from 0-255",
|
||||
"Math.idiv": "Returns the value of integer signed 32 bit division of two numbers.",
|
||||
"Math.idiv|param|x": "The first number",
|
||||
"Math.idiv|param|y": "The second number",
|
||||
"Math.imul": "Returns the value of integer signed 32 bit multiplication of two numbers.",
|
||||
"Math.imul|param|x": "The first number",
|
||||
"Math.imul|param|y": "The second number",
|
||||
"Math.isin": "Returns the sine of an input angle. This is an 8-bit approximation.",
|
||||
"Math.isin|param|theta": "input angle from 0-255",
|
||||
"Math.log": "Returns the natural logarithm (base e) of a number.",
|
||||
"Math.log|param|x": "A number",
|
||||
"Math.map": "Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.",
|
||||
"Math.map|param|fromHigh": "the upper bound of the value's current range, eg: 1023",
|
||||
"Math.map|param|fromLow": "the lower bound of the value's current range",
|
||||
"Math.map|param|toHigh": "the upper bound of the value's target range, eg: 4",
|
||||
"Math.map|param|toLow": "the lower bound of the value's target range",
|
||||
"Math.map|param|value": "value to map in ranges",
|
||||
"Math.max": "Returns the larger of two supplied numeric expressions.",
|
||||
"Math.min": "Returns the smaller of two supplied numeric expressions.",
|
||||
"Math.pow": "Returns the value of a base expression taken to a specified power.",
|
||||
"Math.pow|param|x": "The base value of the expression.",
|
||||
"Math.pow|param|y": "The exponent value of the expression.",
|
||||
"Math.random": "Returns a pseudorandom number between 0 and 1.",
|
||||
"Math.randomRange": "Returns a pseudorandom number between min and max included.\nIf both numbers are integral, the result is integral.",
|
||||
"Math.randomRange|param|max": "the upper inclusive bound, eg: 10",
|
||||
"Math.randomRange|param|min": "the lower inclusive bound, eg: 0",
|
||||
"Math.round": "Returns a supplied numeric expression rounded to the nearest number.",
|
||||
"Math.round|param|x": "The value to be rounded to the nearest number.",
|
||||
"Math.sign": "Returns the sign of the x, indicating whether x is positive, negative or zero.",
|
||||
"Math.sign|param|x": "The numeric expression to test",
|
||||
"Math.sin": "Returns the sine of a number.",
|
||||
"Math.sin|param|x": "An angle in radians",
|
||||
"Math.sqrt": "Returns the square root of a number.",
|
||||
"Math.sqrt|param|x": "A numeric expression.",
|
||||
"Math.tan": "Returns the tangent of a number.",
|
||||
"Math.tan|param|x": "An angle in radians",
|
||||
"Math.trunc": "Returns the number with the decimal part truncated.",
|
||||
"Math.trunc|param|x": "A numeric expression.",
|
||||
"Number.toString": "Returns a string representation of a number.",
|
||||
"String": "Combine, split, and search text strings.\n\nCombine, split, and search text strings.",
|
||||
"String.charAt": "Return the character at the specified index.",
|
||||
"String.charAt|param|index": "The zero-based index of the desired character.",
|
||||
"String.charCodeAt": "Return the Unicode value of the character at the specified location.",
|
||||
"String.charCodeAt|param|index": "The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.",
|
||||
"String.compare": "See how the order of characters in two strings is different (in ASCII encoding).",
|
||||
"String.compare|param|that": "String to compare to target string",
|
||||
"String.concat": "Returns a string that contains the concatenation of two or more strings.",
|
||||
"String.concat|param|other": "The string to append to the end of the string.",
|
||||
"String.fromCharCode": "Make a string from the given ASCII character code.",
|
||||
"String.isEmpty": "Returns a value indicating if the string is empty",
|
||||
"String.length": "Returns the length of a String object.",
|
||||
"String.substr": "Return a substring of the current string.",
|
||||
"String.substr|param|length": "number of characters to extract",
|
||||
"String.substr|param|start": "first character index; can be negative from counting from the end, eg:0",
|
||||
"control": "Program controls and events.",
|
||||
"control.AnimationQueue.cancel": "Cancels the current running animation and clears the queue",
|
||||
"control.AnimationQueue.runUntilDone": "Runs 'render' in a loop until it returns false or the 'stop' function is called",
|
||||
"control.assert": "Display an error code and stop the program when the assertion is `false`.",
|
||||
"control.deviceSerialNumber": "Derive a unique, consistent serial number of this device from internal data.",
|
||||
"control.millis": "Gets the number of milliseconds elapsed since power on.",
|
||||
"control.onEvent": "Run code when a registered event happens.",
|
||||
"control.onEvent|param|value": "the event value to match",
|
||||
"control.panic": "Display an error code and stop the program.",
|
||||
"control.panic|param|code": "an error number to display. eg: 5",
|
||||
"control.reset": "Reset the device.",
|
||||
"control.runInParallel": "Run other code in the parallel.",
|
||||
"control.waitForEvent": "Blocks the calling thread until the specified event is raised.",
|
||||
"control.waitMicros": "Block the current fiber for the given microseconds",
|
||||
"control.waitMicros|param|micros": "number of micro-seconds to wait. eg: 4",
|
||||
"hex": "Tagged hex literal converter",
|
||||
"loops.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
|
||||
"loops.pause": "Pause for the specified time in milliseconds",
|
||||
"loops.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000",
|
||||
"parseInt": "Convert a string to an integer.",
|
||||
"pauseUntil": "Busy wait for a condition to be true",
|
||||
"pauseUntil|param|condition": "condition to test for",
|
||||
"pauseUntil|param|timeOut": "if positive, maximum duration to wait for in milliseconds",
|
||||
"serial": "Reading and writing data over a serial connection.",
|
||||
"serial.writeBuffer": "Send a buffer across the serial connection.",
|
||||
"serial.writeLine": "Write a line of text to the serial port.",
|
||||
"serial.writeNumber": "Write a number to the serial port.",
|
||||
"serial.writeString": "Write some text to the serial port.",
|
||||
"serial.writeValue": "Write a name:value pair as a line of text to the serial port.",
|
||||
"serial.writeValue|param|name": "name of the value stream, eg: \"x\"",
|
||||
"serial.writeValue|param|value": "to write"
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
{
|
||||
"Array.indexOf|block": "%list| find index of %value",
|
||||
"Array.insertAt|block": "%list| insert at %index| value %value",
|
||||
"Array.length|block": "length of %VALUE",
|
||||
"Array.pop|block": "get and remove last value from %list",
|
||||
"Array.push|block": "%list| add value %value| to end",
|
||||
"Array.removeAt|block": "%list| remove value at %index",
|
||||
"Array.reverse|block": "reverse %list",
|
||||
"Array.shift|block": "get and remove first value from %list",
|
||||
"Array.unshift|block": "%list| insert %value| at beginning",
|
||||
"Array|block": "Array",
|
||||
"Math.constrain|block": "constrain %value|between %low|and %high",
|
||||
"Math.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
|
||||
"Math.randomRange|block": "pick random %min|to %limit",
|
||||
"Math|block": "Math",
|
||||
"String.charAt|block": "char from %this=text|at %pos",
|
||||
"String.compare|block": "compare %this=text| to %that",
|
||||
"String.fromCharCode|block": "text from char code %code",
|
||||
"String.length|block": "length of %VALUE",
|
||||
"String.substr|block": "substring of %this=text|from %start|of length %length",
|
||||
"String|block": "String",
|
||||
"control.assert|block": "assert %cond|with value %code",
|
||||
"control.deviceSerialNumber|block": "device serial number",
|
||||
"control.millis|block": "millis (ms)",
|
||||
"control.onEvent|block": "on event|from %src|with value %value",
|
||||
"control.panic|block": "panic %code",
|
||||
"control.reset|block": "reset",
|
||||
"control.runInParallel|block": "run in parallel",
|
||||
"control.waitForEvent|block": "wait for event|from %src|with value %value",
|
||||
"control.waitMicros|block": "wait (µs)%micros",
|
||||
"control|block": "control",
|
||||
"fieldeditors|block": "fieldeditors",
|
||||
"loops.forever|block": "forever",
|
||||
"loops.pause|block": "pause %pause=timePicker|ms",
|
||||
"loops|block": "loops",
|
||||
"parseInt|block": "parse to integer %text",
|
||||
"serial.writeBuffer|block": "serial|write buffer %buffer",
|
||||
"serial.writeLine|block": "serial|write line %text",
|
||||
"serial.writeNumber|block": "serial|write number %value",
|
||||
"serial.writeString|block": "serial|write string %text",
|
||||
"serial.writeValue|block": "serial|write value %name|= %value",
|
||||
"serial|block": "serial",
|
||||
"{id:category}Array": "Array",
|
||||
"{id:category}Arrays": "Arrays",
|
||||
"{id:category}Boolean": "Boolean",
|
||||
"{id:category}Buffer": "Buffer",
|
||||
"{id:category}Control": "Control",
|
||||
"{id:category}Helpers": "Helpers",
|
||||
"{id:category}Loops": "Loops",
|
||||
"{id:category}Math": "Math",
|
||||
"{id:category}Number": "Number",
|
||||
"{id:category}Serial": "Serial",
|
||||
"{id:category}String": "String",
|
||||
"{id:category}Text": "Text"
|
||||
}
|
34
libs/base/enums.d.ts
vendored
@ -1,34 +0,0 @@
|
||||
// Auto-generated. Do not edit.
|
||||
|
||||
|
||||
declare const enum NumberFormat {
|
||||
Int8LE = 1,
|
||||
UInt8LE = 2,
|
||||
Int16LE = 3,
|
||||
UInt16LE = 4,
|
||||
Int32LE = 5,
|
||||
Int8BE = 6,
|
||||
UInt8BE = 7,
|
||||
Int16BE = 8,
|
||||
UInt16BE = 9,
|
||||
Int32BE = 10,
|
||||
|
||||
UInt32LE = 11,
|
||||
UInt32BE = 12,
|
||||
Float32LE = 13,
|
||||
Float64LE = 14,
|
||||
Float32BE = 15,
|
||||
Float64BE = 16,
|
||||
}
|
||||
|
||||
|
||||
declare const enum ValType {
|
||||
Undefined = 0,
|
||||
Boolean = 1,
|
||||
Number = 2,
|
||||
String = 3,
|
||||
Object = 4,
|
||||
Function = 5,
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
159
libs/base/shims.d.ts
vendored
@ -1,159 +0,0 @@
|
||||
// Auto-generated. Do not edit.
|
||||
|
||||
|
||||
|
||||
//% indexerGet=BufferMethods::getByte indexerSet=BufferMethods::setByte
|
||||
declare interface Buffer {
|
||||
/**
|
||||
* Write a number in specified format in the buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::setNumber
|
||||
setNumber(format: NumberFormat, offset: int32, value: number): void;
|
||||
|
||||
/**
|
||||
* Read a number in specified format from the buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::getNumber
|
||||
getNumber(format: NumberFormat, offset: int32): number;
|
||||
|
||||
/** Returns the length of a Buffer object. */
|
||||
//% property shim=BufferMethods::length
|
||||
length: int32;
|
||||
|
||||
/**
|
||||
* Fill (a fragment) of the buffer with given value.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=BufferMethods::fill
|
||||
fill(value: int32, offset?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Return a copy of a fragment of a buffer.
|
||||
*/
|
||||
//% offset.defl=0 length.defl=-1 shim=BufferMethods::slice
|
||||
slice(offset?: int32, length?: int32): Buffer;
|
||||
|
||||
/**
|
||||
* Shift buffer left in place, with zero padding.
|
||||
* @param offset number of bytes to shift; use negative value to shift right
|
||||
* @param start start offset in buffer. Default is 0.
|
||||
* @param length number of elements in buffer. If negative, length is set as the buffer length minus
|
||||
* start. eg: -1
|
||||
*/
|
||||
//% start.defl=0 length.defl=-1 shim=BufferMethods::shift
|
||||
shift(offset: int32, start?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Convert a buffer to its hexadecimal representation.
|
||||
*/
|
||||
//% shim=BufferMethods::toHex
|
||||
toHex(): string;
|
||||
|
||||
/**
|
||||
* Rotate buffer left in place.
|
||||
* @param offset number of bytes to shift; use negative value to shift right
|
||||
* @param start start offset in buffer. Default is 0.
|
||||
* @param length number of elements in buffer. If negative, length is set as the buffer length minus
|
||||
* start. eg: -1
|
||||
*/
|
||||
//% start.defl=0 length.defl=-1 shim=BufferMethods::rotate
|
||||
rotate(offset: int32, start?: int32, length?: int32): void;
|
||||
|
||||
/**
|
||||
* Write contents of `src` at `dstOffset` in current buffer.
|
||||
*/
|
||||
//% shim=BufferMethods::write
|
||||
write(dstOffset: int32, src: Buffer): void;
|
||||
}
|
||||
declare namespace loops {
|
||||
|
||||
/**
|
||||
* Repeats the code forever in the background. On each iteration, allows other codes to run.
|
||||
* @param body code to execute
|
||||
*/
|
||||
//% help=loops/forever weight=100 afterOnStart=true
|
||||
//% blockId=forever block="forever" blockAllowMultiple=1 shim=loops::forever
|
||||
function forever(a: () => void): void;
|
||||
|
||||
/**
|
||||
* Pause for the specified time in milliseconds
|
||||
* @param ms how long to pause for, eg: 100, 200, 500, 1000, 2000
|
||||
*/
|
||||
//% help=loops/pause weight=99
|
||||
//% async block="pause %pause=timePicker|ms"
|
||||
//% blockId=device_pause shim=loops::pause
|
||||
function pause(ms: int32): void;
|
||||
}
|
||||
declare namespace control {
|
||||
|
||||
/**
|
||||
* Gets the number of milliseconds elapsed since power on.
|
||||
*/
|
||||
//% help=control/millis weight=50
|
||||
//% blockId=control_running_time block="millis (ms)" shim=control::millis
|
||||
function millis(): int32;
|
||||
|
||||
/**
|
||||
* Run code when a registered event happens.
|
||||
* @param id the event compoent id
|
||||
* @param value the event value to match
|
||||
*/
|
||||
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src|with value %value"
|
||||
//% blockExternalInputs=1
|
||||
//% help="control/on-event" flags.defl=16 shim=control::onEvent
|
||||
function onEvent(src: int32, value: int32, handler: () => void, flags?: int32): void;
|
||||
|
||||
/**
|
||||
* Reset the device.
|
||||
*/
|
||||
//% weight=30 async help=control/reset blockGap=8
|
||||
//% blockId="control_reset" block="reset" shim=control::reset
|
||||
function reset(): void;
|
||||
|
||||
/**
|
||||
* Block the current fiber for the given microseconds
|
||||
* @param micros number of micro-seconds to wait. eg: 4
|
||||
*/
|
||||
//% help=control/wait-micros weight=29 async
|
||||
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
|
||||
function waitMicros(micros: int32): void;
|
||||
|
||||
/**
|
||||
* Run other code in the parallel.
|
||||
*/
|
||||
//% help=control/run-in-parallel handlerStatement=1
|
||||
//% blockId="control_run_in_parallel" block="run in parallel" blockGap=8 shim=control::runInParallel
|
||||
function runInParallel(a: () => void): void;
|
||||
|
||||
/**
|
||||
* Blocks the calling thread until the specified event is raised.
|
||||
*/
|
||||
//% help=control/wait-for-event async
|
||||
//% blockId=control_wait_for_event block="wait for event|from %src|with value %value" shim=control::waitForEvent
|
||||
function waitForEvent(src: int32, value: int32): void;
|
||||
|
||||
/**
|
||||
* Derive a unique, consistent serial number of this device from internal data.
|
||||
*/
|
||||
//% blockId="control_device_serial_number" block="device serial number" weight=9
|
||||
//% help=control/device-serial-number shim=control::deviceSerialNumber
|
||||
function deviceSerialNumber(): int32;
|
||||
}
|
||||
declare namespace serial {
|
||||
|
||||
/**
|
||||
* Write some text to the serial port.
|
||||
*/
|
||||
//% help=serial/write-string
|
||||
//% weight=87 blockHidden=true
|
||||
//% blockId=serial_writestring block="serial|write string %text" shim=serial::writeString
|
||||
function writeString(text: string): void;
|
||||
|
||||
/**
|
||||
* Send a buffer across the serial connection.
|
||||
*/
|
||||
//% help=serial/write-buffer weight=6 blockHidden=true
|
||||
//% blockId=serial_writebuffer block="serial|write buffer %buffer" shim=serial::writeBuffer
|
||||
function writeBuffer(buffer: Buffer): void;
|
||||
}
|
||||
|
||||
// Auto-generated. Do not edit. Really.
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"chassis": "A differential drive robot",
|
||||
"chassis.Chassis": "A differential drive robot",
|
||||
"chassis.Chassis.drive": "Makes a differential drive robot move with a given speed (cm/s) and rotation rate (deg/s)\nusing a unicycle model.",
|
||||
"chassis.Chassis.drive|param|rotationSpeed": "rotation of the robot around the center point, eg: 30",
|
||||
"chassis.Chassis.drive|param|speed": "speed of the center point between motors, eg: 10",
|
||||
"chassis.Chassis.setBaseLength": "Sets the base length in centimeters",
|
||||
"chassis.Chassis.setMotors": "Sets the motors used by the chassis, default is B+C",
|
||||
"chassis.Chassis.setWheelRadius": "Sets the wheel radius in centimeters"
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"chassis.Chassis.drive|block": "drive %chassis|at %speed|cm/s|turning %rotationSpeed|deg/s",
|
||||
"chassis.Chassis.setBaseLength|block": "set %chassis|base length to %cm|(cm)",
|
||||
"chassis.Chassis.setMotors|block": "set %chassis|motors to %motors",
|
||||
"chassis.Chassis.setWheelRadius|block": "set %chassis|wheel radius to %cm|(cm)",
|
||||
"chassis|block": "chassis",
|
||||
"{id:category}Chassis": "Chassis"
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"sensors.ColorSensor": "The color sensor is a digital sensor that can detect the color or intensity\nof light that enters the small window on the face of the sensor.",
|
||||
"sensors.ColorSensor.calibrateLight": "Collects measurement of the light condition and adjusts the threshold to 10% / 90%.",
|
||||
"sensors.ColorSensor.color": "Get the current color from the color sensor.",
|
||||
"sensors.ColorSensor.colorMode": "Gets the current color mode",
|
||||
"sensors.ColorSensor.light": "Measures the ambient or reflected light value from 0 (darkest) to 100 (brightest).",
|
||||
"sensors.ColorSensor.onColorDetected": "Registers code to run when the given color is detected.",
|
||||
"sensors.ColorSensor.onColorDetected|param|color": "the color to detect, eg: ColorSensorColor.Blue",
|
||||
"sensors.ColorSensor.onColorDetected|param|handler": "the code to run when detected",
|
||||
"sensors.ColorSensor.onLightChanged": "Registers code to run when the ambient light changes.",
|
||||
"sensors.ColorSensor.onLightChanged|param|condition": "the light condition",
|
||||
"sensors.ColorSensor.onLightChanged|param|handler": "the code to run when detected",
|
||||
"sensors.ColorSensor.pauseForColor": "Waits for the given color to be detected",
|
||||
"sensors.ColorSensor.pauseForColor|param|color": "the color to detect",
|
||||
"sensors.ColorSensor.pauseForLight": "Waits for the given color to be detected",
|
||||
"sensors.ColorSensor.setThreshold": "Sets a threshold value",
|
||||
"sensors.ColorSensor.setThreshold|param|condition": "the dark or bright light condition",
|
||||
"sensors.ColorSensor.setThreshold|param|value": "the value threshold",
|
||||
"sensors.ColorSensor.threshold": "Gets the threshold value",
|
||||
"sensors.ColorSensor.threshold|param|condition": "the light condition",
|
||||
"sensors.color": "Returns a color that the sensor can detect"
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
"ColorSensorColor.Black|block": "black",
|
||||
"ColorSensorColor.Blue|block": "blue",
|
||||
"ColorSensorColor.Brown|block": "brown",
|
||||
"ColorSensorColor.Green|block": "green",
|
||||
"ColorSensorColor.None|block": "none",
|
||||
"ColorSensorColor.Red|block": "red",
|
||||
"ColorSensorColor.White|block": "white",
|
||||
"ColorSensorColor.Yellow|block": "yellow",
|
||||
"ColorSensorMode.AmbientLightIntensity|block": "ambient light intensity",
|
||||
"ColorSensorMode.Color|block": "color",
|
||||
"ColorSensorMode.ReflectedLightIntensity|block": "reflected light intensity",
|
||||
"LightCondition.Dark|block": "dark",
|
||||
"LightIntensityMode.Ambient|block": "ambient light",
|
||||
"LightIntensityMode.Reflected|block": "reflected light",
|
||||
"sensors.ColorSensor.calibrateLight|block": "calibrate|%sensor|for %mode|light",
|
||||
"sensors.ColorSensor.color|block": "%sensor| color",
|
||||
"sensors.ColorSensor.light|block": "%sensor|%mode",
|
||||
"sensors.ColorSensor.onColorDetected|block": "on %sensor|detected color %color",
|
||||
"sensors.ColorSensor.onLightChanged|block": "on %sensor|%mode|%condition",
|
||||
"sensors.ColorSensor.pauseForColor|block": "pause %sensor|for color %color",
|
||||
"sensors.ColorSensor.pauseForLight|block": "pause %sensor|for %mode|%condition",
|
||||
"sensors.ColorSensor.setThreshold|block": "set %sensor|%condition|to %value",
|
||||
"sensors.ColorSensor.threshold|block": "%sensor|%condition",
|
||||
"sensors.color1|block": "color 1",
|
||||
"sensors.color2|block": "color 2",
|
||||
"sensors.color3|block": "color 3",
|
||||
"sensors.color4|block": "color 4",
|
||||
"sensors.color|block": "color %color",
|
||||
"sensors|block": "sensors",
|
||||
"{id:category}Sensors": "Sensors",
|
||||
"{id:group}Color Sensor": "Color Sensor",
|
||||
"{id:group}Threshold": "Threshold"
|
||||
}
|
@ -115,7 +115,7 @@ namespace sensors {
|
||||
//% parts="colorsensor"
|
||||
//% blockNamespace=sensors
|
||||
//% sensor.fieldEditor="ports"
|
||||
//% weight=100 blockGap=8
|
||||
//% weight=100 blockGap=12
|
||||
//% group="Color Sensor"
|
||||
onColorDetected(color: ColorSensorColor, handler: () => void) {
|
||||
this.setMode(ColorSensorMode.Color)
|
||||
@ -174,7 +174,7 @@ namespace sensors {
|
||||
//% parts="colorsensor"
|
||||
//% blockNamespace=sensors
|
||||
//% sensor.fieldEditor="ports"
|
||||
//% weight=89 blockGap=8
|
||||
//% weight=89 blockGap=12
|
||||
//% group="Color Sensor"
|
||||
onLightChanged(mode: LightIntensityMode, condition: LightCondition, handler: () => void) {
|
||||
this.setMode(<ColorSensorMode><number>mode)
|
||||
|
@ -3,9 +3,9 @@
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
if (sensors.color1.ambientLight() > 20) {
|
||||
brick.setLight(BrickLight.Green)
|
||||
brick.setStatusLight(StatusLight.Green)
|
||||
} else {
|
||||
brick.setLight(BrickLight.Orange)
|
||||
brick.setStatusLight(StatusLight.Orange)
|
||||
}
|
||||
})
|
||||
```
|
@ -3,9 +3,9 @@
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
if (sensors.color1.color() == ColorSensorColor.Green) {
|
||||
brick.setLight(BrickLight.Green)
|
||||
brick.setStatusLight(StatusLight.Green)
|
||||
} else {
|
||||
brick.setLight(BrickLight.Orange)
|
||||
brick.setStatusLight(StatusLight.Orange)
|
||||
}
|
||||
})
|
||||
```
|
@ -3,9 +3,9 @@
|
||||
```blocks
|
||||
loops.forever(function () {
|
||||
if (sensors.color1.reflectedLight() > 20) {
|
||||
brick.setLight(BrickLight.Green)
|
||||
brick.setStatusLight(StatusLight.Green)
|
||||
} else {
|
||||
brick.setLight(BrickLight.Orange)
|
||||
brick.setStatusLight(StatusLight.Orange)
|
||||
}
|
||||
})
|
||||
```
|
@ -1,115 +0,0 @@
|
||||
{
|
||||
"BrickLight": "Patterns for lights under the buttons.",
|
||||
"ButtonEvent": "User interaction on buttons",
|
||||
"Draw": "Drawing modes",
|
||||
"Image.buffer": "Returns the underlaying Buffer object.",
|
||||
"Image.doubled": "Double size of an image.",
|
||||
"Image.draw": "Draw an image on the screen.",
|
||||
"Image.height": "Returns the height of an image.",
|
||||
"Image.width": "Returns the width of an image.",
|
||||
"MMap.getNumber": "Read a number in specified format from the buffer.",
|
||||
"MMap.ioctl": "Perform ioctl(2) on the underlaying file",
|
||||
"MMap.length": "Returns the length of a Buffer object.",
|
||||
"MMap.lseek": "Set pointer on the underlaying file.",
|
||||
"MMap.read": "Perform read(2) on the underlaying file",
|
||||
"MMap.setNumber": "Write a number in specified format in the buffer.",
|
||||
"MMap.slice": "Read a range of bytes into a buffer.",
|
||||
"MMap.write": "Perform write(2) on the underlaying file",
|
||||
"SeekWhence": "Mode for lseek()",
|
||||
"brick.Button": "Generic button class, for device buttons and sensors.",
|
||||
"brick.Button.isPressed": "Check if button is currently pressed or not.",
|
||||
"brick.Button.onEvent": "Do something when a button or sensor is clicked, up or down.",
|
||||
"brick.Button.onEvent|param|body": "code to run when the event is raised",
|
||||
"brick.Button.pauseUntil": "Waits until the event is raised",
|
||||
"brick.Button.pauseUntil|param|ev": "the event to wait for",
|
||||
"brick.Button.wasPressed": "See if the button was pressed again since the last time you checked.",
|
||||
"brick.batteryLevel": "Returns the current battery level",
|
||||
"brick.buttonDown": "Down button on the EV3 Brick.",
|
||||
"brick.buttonEnter": "Enter button on the EV3 Brick.",
|
||||
"brick.buttonLeft": "Left button on the EV3 Brick.",
|
||||
"brick.buttonRight": "Right button on the EV3 Brick.",
|
||||
"brick.buttonUp": "Up button on the EV3 Brick.",
|
||||
"brick.clearScreen": "Clear the screen",
|
||||
"brick.printPorts": "Print the port states on the screen",
|
||||
"brick.setLight": "Set lights.",
|
||||
"brick.setLight|param|pattern": "the lights pattern to use. eg: BrickLight.Orange",
|
||||
"brick.showImage": "Show an image on the screen",
|
||||
"brick.showImage|param|image": "image to draw",
|
||||
"brick.showNumber": "Shows a number on the screen",
|
||||
"brick.showNumber|param|line": "the line number to print the text at, eg: 1",
|
||||
"brick.showNumber|param|value": "the numeric value",
|
||||
"brick.showString": "Show text on the screen at a specific line.",
|
||||
"brick.showString|param|line": "the line number to print the text at, eg: 1",
|
||||
"brick.showString|param|text": "the text to print on the screen, eg: \"Hello world\"",
|
||||
"brick.showValue": "Shows a name, value pair on the screen",
|
||||
"brick.showValue|param|line": "the line number to print the text at, eg: 1",
|
||||
"brick.showValue|param|value": "the numeric value",
|
||||
"console": "Reading and writing data to the console output.\n\nReading and writing data to the console output.",
|
||||
"console.addListener": "Adds a listener for the log messages",
|
||||
"console.log": "Write a line of text to the console output.",
|
||||
"console.logValue": "Write a name:value pair as a line of text to the console output.",
|
||||
"console.logValue|param|name": "name of the value stream, eg: \"x\"",
|
||||
"console.logValue|param|value": "to write",
|
||||
"console.sendToScreen": "Sends the log messages to the brick screen and uses the brick up and down buttons to scroll.",
|
||||
"control": "Program controls and events.",
|
||||
"control.Timer": "A timer",
|
||||
"control.Timer.millis": "Gets the elapsed time in millis since the last reset",
|
||||
"control.Timer.pauseUntil": "Pauses until the timer reaches the given amount of milliseconds",
|
||||
"control.Timer.pauseUntil|param|ms": "how long to pause for, eg: 5, 100, 200, 500, 1000, 2000",
|
||||
"control.Timer.reset": "Resets the timer",
|
||||
"control.Timer.seconds": "Gets the elapsed time in seconds since the last reset",
|
||||
"control.allocateNotifyEvent": "Allocates the next user notification event",
|
||||
"control.deviceFirmwareVersion": "Determine the version of system software currently running.",
|
||||
"control.dmesg": "Write data to DMESG debugging buffer.",
|
||||
"control.mmap": "Create new file mapping in memory",
|
||||
"control.raiseEvent": "Announce that an event happened to registered handlers.",
|
||||
"control.raiseEvent|param|src": "ID of the Component that generated the event",
|
||||
"control.raiseEvent|param|value": "Component specific code indicating the cause of the event.",
|
||||
"motors.Motor.angle": "Gets motor angle.",
|
||||
"motors.Motor.clearCounts": "Clears the motor count",
|
||||
"motors.Motor.setRegulated": "Indicates if the motor speed should be regulated. Default is true.",
|
||||
"motors.Motor.setRegulated|param|value": "true for regulated motor",
|
||||
"motors.Motor.speed": "Gets motor actual speed.",
|
||||
"motors.Motor.tacho": "Gets motor tachometer count.",
|
||||
"motors.Motor.toString": "Returns the status of the motor",
|
||||
"motors.MotorBase.isReady": "Returns a value indicating if the motor is still running a previous command.",
|
||||
"motors.MotorBase.pauseUntilReady": "Pauses the execution until the previous command finished.",
|
||||
"motors.MotorBase.pauseUntilReady|param|timeOut": "optional maximum pausing time in milliseconds",
|
||||
"motors.MotorBase.reset": "Resets the motor(s).",
|
||||
"motors.MotorBase.setBrake": "Sets the automatic brake on or off when the motor is off",
|
||||
"motors.MotorBase.setBrake|param|brake": "a value indicating if the motor should break when off",
|
||||
"motors.MotorBase.setReversed": "Reverses the motor polarity",
|
||||
"motors.MotorBase.setSpeed": "Sets the motor speed for limited time or distance.",
|
||||
"motors.MotorBase.setSpeed|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
||||
"motors.MotorBase.setSpeed|param|unit": "(optional) unit of the value",
|
||||
"motors.MotorBase.setSpeed|param|value": "(optional) measured distance or rotation",
|
||||
"motors.MotorBase.stop": "Stops the motor(s).",
|
||||
"motors.SynchedMotorPair.steer": "Turns the motor and the follower motor by a number of rotations",
|
||||
"motors.SynchedMotorPair.steer|param|speed": "the speed from ``100`` full forward to ``-100`` full backward, eg: 50",
|
||||
"motors.SynchedMotorPair.steer|param|turnRatio": "the ratio of power sent to the follower motor, from ``-200`` to ``200``, eg: 0",
|
||||
"motors.SynchedMotorPair.steer|param|unit": "(optional) unit of the value",
|
||||
"motors.SynchedMotorPair.steer|param|value": "(optional) move duration or rotation",
|
||||
"motors.SynchedMotorPair.tank": "The Move Tank block can make a robot drive forward, backward, turn, or stop. \nUse the Move Tank block for robot vehicles that have two Large Motors, \nwith one motor driving the left side of the vehicle and the other the right side. \nYou can make the two motors go at different speeds or in different directions \nto make your robot turn.",
|
||||
"motors.SynchedMotorPair.tank|param|speedLeft": "the speed on the left motor, eg: 50",
|
||||
"motors.SynchedMotorPair.tank|param|speedRight": "the speed on the right motor, eg: 50",
|
||||
"motors.SynchedMotorPair.tank|param|unit": "(optional) unit of the value",
|
||||
"motors.SynchedMotorPair.tank|param|value": "(optional) move duration or rotation",
|
||||
"motors.SynchedMotorPair.toString": "Returns the name(s) of the motor",
|
||||
"motors.mkCmd": "Allocates a message buffer",
|
||||
"motors.mkCmd|param|addSize": "required additional bytes",
|
||||
"motors.mkCmd|param|cmd": "command id",
|
||||
"motors.mkCmd|param|out": "ports",
|
||||
"motors.readPWM": "Sends and receives a message from the motors device",
|
||||
"motors.readPWM|param|buf": "message buffer",
|
||||
"motors.resetAllMotors": "Resets all motors",
|
||||
"motors.stopAllMotors": "Stops all motors",
|
||||
"motors.writePWM": "Sends a command to the motors device",
|
||||
"motors.writePWM|param|buf": "the command buffer",
|
||||
"output.createBuffer": "Create a new zero-initialized buffer.",
|
||||
"output.createBuffer|param|size": "number of bytes in the buffer",
|
||||
"screen.clear": "Clear screen and reset font to normal.",
|
||||
"screen.imageOf": "Makes an image bound to a buffer.",
|
||||
"screen.unpackPNG": "Decompresses a 1-bit gray scale PNG image to image format.",
|
||||
"serial": "Reading and writing data over a serial connection.",
|
||||
"serial.writeDmesg": "Send DMESG debug buffer over serial."
|
||||
}
|