Compare commits

..

11 Commits

Author SHA1 Message Date
239827c259 0.0.101 2018-02-14 11:06:56 -08:00
cd0097749a updated readme 2018-02-14 11:00:12 -08:00
94db31beb7 bring back the shims 2018-02-14 10:56:50 -08:00
408631d426 upgrading common packages 2018-02-14 10:32:09 -08:00
2407e7e179 0.0.100 2018-02-14 10:16:57 -08:00
f63b447fee upgraded to v3.4.3 2018-02-14 10:16:27 -08:00
bbd1a9d215 Merge branch 'master' of https://github.com/microsoft/pxt-ev3 2018-02-14 10:15:28 -08:00
cfc4688fbe adding targetconfig to package 2018-02-14 09:49:47 -08:00
24d48c0171 update firmware url 2018-02-14 09:36:20 -08:00
523c507c35 Projectupdate1 (#325)
* integrating test lesson from lego

* adding side card annotations
2018-02-14 08:56:12 -08:00
d6cbbcc3d9 support for importing urls 2018-02-13 21:41:49 -08:00
41 changed files with 852 additions and 239 deletions

2
.gitignore vendored
View File

@ -17,8 +17,6 @@ clients/**/bin/**
clients/**/obj/**
clients/electron/projects
libs/**/_locales/**
libs/**/shims.d.ts
libs/**/enums.d.ts
videos/**

View File

@ -2,7 +2,7 @@
[![Build Status](https://ci2.dot.net/buildStatus/icon?job=Private/pxt_project_rainbow/master/pxt-ev3_Push)](https://ci2.dot.net/job/Private/job/pxt_project_rainbow/job/master/job/pxt-ev3_Push/)
This repo contains the editor target hosted at https://d541eec2-1e96-4b7b-a223-da9d01d0337a.pxt.io/
This repo contains the editor target hosted at https://makecode.legoeducation.com
LEGO Auth: https://src.education.lego.com/groups/ev3-makecode (use Google Authenticator)
LEGO Chat: https://chat.internal.education.lego.com/make-code/channels/town-square
@ -11,7 +11,7 @@ LEGO Chat: https://chat.internal.education.lego.com/make-code/channels/town-squa
These instructions assume familiarity with dev tools and languages.
* install Node.js 6+
* install Node.js 8.9.4+
* install Docker; make sure `docker` command is in your `PATH`
* (optional) install [Visual Studio Code](https://code.visualstudio.com/)
@ -58,12 +58,6 @@ cd libs/core
pxt deploy
```
### Hosted editor
Currently hosted at:
https://d541eec2-1e96-4b7b-a223-da9d01d0337a.pxt.io/
### Jenkins build
https://ci2.dot.net/job/Private/job/pxt_project_rainbow/job/master/

View File

@ -2,14 +2,30 @@
## Projects #projects
* [Getting Started](/getting-started)
* [Try](/getting-started/try)
* [Use](/getting-started/use)
* [Coding](/coding)
* [Autonomous Parking](/coding/autonomous-parking)
* [Object Detection](/coding/object-detection)
* [Line Following](/coding/line-following)
* [Design Engineering](/design-engineering)
* [Make It Move Without Wheels](/design-engineering/make-it-move)
* [Make It Smarter and Faster](/design-engineering/make-it-faster)
* [Make a System that Communicates](/design-engineering/make-it-communicate)
* [Maker](/maker)
* [Sound Machine](/maker/sound-machine)
* [Make a Sound Machine](/maker/sound-machine)
* [Examples](/examples)
* [Make it move](/lessons/make-it-move)
* [Line detection](/lessons/line-detection)
* [Sound of Color](/maker/sound-of-color)
* [Security Gadget](/maker/security-gadget)
* [Intruder detector](/maker/intruder-detector)
* [Puppet](/maker/puppet)
* [Coding](/coding)
* [Three Point Turn 1](/coding/three-point-turn-1)
* [Three Point Turn 2](/coding/three-point-turn-2)
* [Three Point Turn 3](/coding/three-point-turn-3)
@ -34,10 +50,6 @@
* [Roaming 1](/coding/roaming-1)
* [Roaming 2](/coding/roaming-2)
* [Lessons](/lessons)
* [Make it move](/lessons/make-it-move)
* [Line detection](/lessons/line-detection)
## Reference #reference
* [Reference](/reference)
@ -67,7 +79,7 @@
* [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)
* [stop all motors](/reference/motors/stop-all)
* [Sensors](/reference/sensors)
* [Touch](/reference/sensors/touch-sensor)
* [on event](/reference/sensors/touch-sensor/on-event)

View File

@ -1,171 +1,24 @@
# Coding Activites
12 computer science activities, with cross-curricular opportunities in design and technology, science, and math.
* [Download Curriculum Materials](https://education.lego.com/en-us/downloads/mindstorms-ev3)
## Three Point Turn
## Projects
```codecard
[
{
"name": "Three Point Turn 1",
"description": "Activity 1",
"url":"/coding/three-point-turn-1",
"cardType": "example"
"name": "Autonomous Parking",
"description": "TBD",
"url":"/coding/autonomous-parking",
"cardType": "side"
}, {
"name": "Three Point Turn 2",
"description": "Activity 2",
"url":"/coding/three-point-turn-2",
"cardType": "example"
"name": "Object Detection",
"description": "TBD",
"url":"/coding/object-detection",
"cardType": "side"
}, {
"name": "Three Point Turn 3",
"description": "Activity 3",
"url":"/coding/three-point-turn-3",
"cardType": "example"
}]
```
## Reversing the robot
```codecard
[{
"name": "Reversing the robot 1",
"description": "Activity 1",
"url":"/coding/reversing-the-robot-1",
"cardType": "example"
}, {
"name": "Reversing the robot 2",
"description": "Activity 2",
"url":"/coding/reversing-the-robot-2",
"cardType": "example"
}, {
"name": "Reversing the robot 3",
"description": "Activity 3",
"url":"/coding/reversing-the-robot-3",
"cardType": "example"
}]
```
## Light the way
```codecard
[{
"name": "Light the way 1",
"description": "Activity 1",
"url":"/coding/light-the-way-1",
"cardType": "example"
}, {
"name": "Light the way 2",
"description": "Activity 2",
"url":"/coding/light-the-way-2",
"cardType": "example"
}, {
"name": "Light the way 3",
"description": "Activity 3",
"url":"/coding/light-the-way-3",
"cardType": "example"
}
]
```
## Traffic Lights
```codecard
[{
"name": "Traffic Lights 1",
"description": "Activity 1",
"url":"/coding/traffic-lights-1",
"cardType": "example"
}, {
"name": "Traffic Lights 2",
"description": "Activity 2",
"url":"/coding/traffic-lights-2",
"cardType": "example"
}, {
"name": "Traffic Lights 3",
"description": "Activity 3",
"url":"/coding/traffic-lights-3",
"cardType": "example"
}
]
```
## Reverse Bepper
```codecard
[{
"name": "Reverse Beeper 1",
"description": "Activity 1",
"url":"/coding/reverse-beeper-1",
"cardType": "example"
}, {
"name": "Reverse Beeper 2",
"description": "Activity 2",
"url":"/coding/reverse-beeper-2",
"cardType": "example"
}, {
"name": "Reverse Beeper 3",
"description": "Activity 3",
"url":"/coding/reverse-beeper-3",
"cardType": "example"
}]
```
## Ignition
```codecard
[{
"name": "Ignition 1",
"description": "Activity 1",
"url":"/coding/ingition-1",
"cardType": "example"
}, {
"name": "Ignition 2",
"description": "Activity 2",
"url":"/coding/ignition-2",
"cardType": "example"
}, {
"name": "Ignition 3",
"description": "Activity 3",
"url":"/coding/ignition-3",
"cardType": "example"
}]
```
## Cruise Control
```codecard
[{
"name": "Cruise Control 1",
"description": "Activity 1",
"url":"/coding/cruise-control-1",
"cardType": "example"
}, {
"name": "Cruise Control 2",
"description": "Activity 2",
"url":"/coding/cruise-control-2",
"cardType": "example"
}, {
"name": "Cruise Control 3",
"description": "Activity 3",
"url":"/coding/cruise-control-3",
"cardType": "example"
}]
```
## Roaming
```codecard
[{
"name": "Roaming 1",
"description": "Activity 1",
"url":"/coding/roaming-1",
"cardType": "example"
}, {
"name": "Roaming 2",
"description": "Activity 2",
"url":"/coding/roaming-2",
"cardType": "example"
"name": "Line Following",
"description": "TBD",
"url":"/coding/line-following",
"cardType": "side"
}]
```

View File

@ -0,0 +1,29 @@
# Design Engineering Projects
## Projects
```codecard
[
{
"name": "Make It Move Without Wheels",
"description": "TBD",
"imageUrl": "/static/lessons/make-it-move.png",
"url": "/design-engineering/make-it-move",
"cardType": "side"
},
{
"name": "Make It Smarter and Faster",
"description": "TBD",
"imageUrl": "/static/lessons/make-it-smarter.png",
"url": "/design-engineering/make-it-move",
"cardType": "side"
},
{
"name": "Make a System that Communicates",
"description": "TBD",
"imageUrl": "/static/lessons/make-a-system.png",
"url": "/design-engineering/make-it-move",
"cardType": "side"
}
]
```

View File

@ -0,0 +1,90 @@
# Make It Move Without Wheels
## ~ avatar
Design, build and program a robot that can move itself using no wheels for locomotion.
## ~
## Connect
### Design Brief
Design, build and program a robot that can move itself a distance of at least 30cm, using at least one motor, using NO wheels for locomotion.
### Brainstorm
Discuss different solutions to the design brief.
Think about:
How can robots move without wheels? For example, how will you:
* Connect the motor(s) to something to make the robot walk, crawl, or wiggle?
How will you program the robot to move? For example, which programming blocks will you use to:
* Turn on and turn off the motor or motors?
* Display the distance moved?
### Select the Best Solution
Describe the solution that you have agreed to build and program.
Think about examples from your brainstorming discussion. Then explain why you chose this solution for the design brief.
![The Mars rover](/static/lessons/make-it-move/hero.png)
https://www.youtube.com/watch?v=ErC_s3hLGMk
## Construct
### Build and Program
Now you are ready to start building and programming your solution!
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations);
motors.stopAll();
```
As you work on your solution:
* Describe one part of your design that worked especially well.
* Describe one design change that you had to make.
What will you try next?
As you test your design solution, use the table for recording your findings.
[**VIEW BUILDING INSTRUCTIONS**](TODO) for a sample solution. (7.8 MB, PDF)
# Contemplate
## Test and Analyze
How well does your solution satisfy the design brief? Record your data. Name the columns and rows, such as Trial Number, Distance Moved, and Observations.
## Review and Revise
Take a moment to reflect on your robot solution.
Think about:
* Is the robot using something other than wheels to move? Trace the movement from the motor axle to the mechanism(s) that drives the robot forward, backward or sideways. Wheels can be used to stabilize the robot but not to drive it.
* Does the robot display the distance moved?
* Is it accurate? How do you know?
Describe two ways you could improve your robot.
# Continue
## Communicate
Here are some ideas:
* Create a video of your project, especially your final presentation and your robots performance.
* Explain some important features of your software program.
* Produce a building guide for your model by taking a series of photographs as you deconstruct it.
* Include an image of your program with comments.
* Add a team photograph!
## ~ avatar
Congratulations! What will you design next?
## ~

View File

@ -2,6 +2,207 @@
Here are some fun programs for your @boardname@!
## Maker
```codecard
[
{
"name": "Sound Of Color",
"description": "Play different sounds based on the color",
"url":"/maker/sound-of-color",
"cardType": "example",
"imageUrl": "/static/maker/sound-of-color.png"
},
{
"name": "Security Gadget",
"description": "Raise the alarm when your brick is lifted!",
"url":"/maker/security-gadget",
"cardType": "example",
"imageUrl": "/static/maker/security-gadget.png"
},
{
"name": "Intruder Detector",
"description": "Raise the alarm when an intruder sneaks in",
"url":"/maker/intruder-detector",
"cardType": "example",
"imageUrl": "/static/maker/intruder-detector.png"
},
{
"name": "Puppet",
"description": "Build an automated puppet",
"url":"/maker/puppet",
"cardType": "example",
"imageUrl": "/static/maker/puppet.png"
}
]
```
## Three Point Turn
```codecard
[
{
"name": "Three Point Turn 1",
"description": "Activity 1",
"url":"/coding/three-point-turn-1",
"cardType": "example"
}, {
"name": "Three Point Turn 2",
"description": "Activity 2",
"url":"/coding/three-point-turn-2",
"cardType": "example"
}, {
"name": "Three Point Turn 3",
"description": "Activity 3",
"url":"/coding/three-point-turn-3",
"cardType": "example"
}]
```
## Reversing the robot
```codecard
[{
"name": "Reversing the robot 1",
"description": "Activity 1",
"url":"/coding/reversing-the-robot-1",
"cardType": "example"
}, {
"name": "Reversing the robot 2",
"description": "Activity 2",
"url":"/coding/reversing-the-robot-2",
"cardType": "example"
}, {
"name": "Reversing the robot 3",
"description": "Activity 3",
"url":"/coding/reversing-the-robot-3",
"cardType": "example"
}]
```
## Light the way
```codecard
[{
"name": "Light the way 1",
"description": "Activity 1",
"url":"/coding/light-the-way-1",
"cardType": "example"
}, {
"name": "Light the way 2",
"description": "Activity 2",
"url":"/coding/light-the-way-2",
"cardType": "example"
}, {
"name": "Light the way 3",
"description": "Activity 3",
"url":"/coding/light-the-way-3",
"cardType": "example"
}
]
```
## Traffic Lights
```codecard
[{
"name": "Traffic Lights 1",
"description": "Activity 1",
"url":"/coding/traffic-lights-1",
"cardType": "example"
}, {
"name": "Traffic Lights 2",
"description": "Activity 2",
"url":"/coding/traffic-lights-2",
"cardType": "example"
}, {
"name": "Traffic Lights 3",
"description": "Activity 3",
"url":"/coding/traffic-lights-3",
"cardType": "example"
}
]
```
## Reverse Bepper
```codecard
[{
"name": "Reverse Beeper 1",
"description": "Activity 1",
"url":"/coding/reverse-beeper-1",
"cardType": "example"
}, {
"name": "Reverse Beeper 2",
"description": "Activity 2",
"url":"/coding/reverse-beeper-2",
"cardType": "example"
}, {
"name": "Reverse Beeper 3",
"description": "Activity 3",
"url":"/coding/reverse-beeper-3",
"cardType": "example"
}]
```
## Ignition
```codecard
[{
"name": "Ignition 1",
"description": "Activity 1",
"url":"/coding/ingition-1",
"cardType": "example"
}, {
"name": "Ignition 2",
"description": "Activity 2",
"url":"/coding/ignition-2",
"cardType": "example"
}, {
"name": "Ignition 3",
"description": "Activity 3",
"url":"/coding/ignition-3",
"cardType": "example"
}]
```
## Cruise Control
```codecard
[{
"name": "Cruise Control 1",
"description": "Activity 1",
"url":"/coding/cruise-control-1",
"cardType": "example"
}, {
"name": "Cruise Control 2",
"description": "Activity 2",
"url":"/coding/cruise-control-2",
"cardType": "example"
}, {
"name": "Cruise Control 3",
"description": "Activity 3",
"url":"/coding/cruise-control-3",
"cardType": "example"
}]
```
## Roaming
```codecard
[{
"name": "Roaming 1",
"description": "Activity 1",
"url":"/coding/roaming-1",
"cardType": "example"
}, {
"name": "Roaming 2",
"description": "Activity 2",
"url":"/coding/roaming-2",
"cardType": "example"
}]
```
## Fun stuff
```codecard

View File

@ -108,7 +108,7 @@ function checkFallen() {
// stop all motors and wait for touch button to be
// pressed
function stop() {
motors.stopAllMotors()
motors.stopAll()
state = 0
moods.knockedOut.show();
sensors.touch3.pauseUntil(ButtonEvent.Pressed)

View File

@ -144,7 +144,7 @@ loops.forever(function () {
let p = 5 - (t2 - t1);
loops.pause(Math.max(1, p))
}
motors.stopAllMotors()
motors.stopAll()
st = 0;
brick.setStatusLight(StatusLight.RedPulse);
brick.showImage(images.eyesKnockedOut)

View File

@ -144,7 +144,7 @@ loops.forever(function () {
let p = 5 - (t2 - t1);
loops.pause(Math.max(1, p))
}
motors.stopAllMotors()
motors.stopAll()
st = 0;
brick.setStatusLight(StatusLight.RedPulse);
brick.showImage(images.eyesKnockedOut)

22
docs/getting-started.md Normal file
View File

@ -0,0 +1,22 @@
# Getting Started
## Projects
```codecard
[
{
"name": "Try",
"imageUrl": "/static/lessons/try.png",
"description": "TBD",
"url": "/getting-started/try",
"cardType": "side"
},
{
"name": "use",
"imageUrl": "/static/lessons/use.png",
"description": "TBD",
"url": "/getting-started/use",
"cardType": "side"
}
]
```

View File

@ -81,7 +81,7 @@ Study the program...what do you think the program will do?
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseForColor(ColorSensorColor.Red)
motors.stopAllMotors()
motors.stopAll()
}
```
@ -148,7 +148,7 @@ while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseForColor(ColorSensorColor.Red)
motors.stopAllMotors()
motors.stopAll()
}
}
```
@ -162,7 +162,7 @@ while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseForColor(ColorSensorColor.Red)
motors.stopAllMotors()
motors.stopAll()
}
while (true) {
@ -183,7 +183,7 @@ while (true) {
motors.largeBC.steer(0, 20)
while (true) {
sensors.color3.pauseForColor(ColorSensorColor.Red)
motors.stopAllMotors()
motors.stopAll()
}
while (true) {
sensors.color3.pauseForColor(ColorSensorColor.Red)

View File

@ -51,7 +51,7 @@ The ``||motors:tank large B+C||`` block will run for `9` rotations when the **ce
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
motors.stopAllMotors()
motors.stopAll()
```
## Program 3 @fullscreen
@ -63,7 +63,7 @@ The ``||motors:tank large B+C||`` will run for `9` rotations when the **center**
```blocks
motors.largeBC.tank(-60, 60, 9, MoveUnit.Rotations)
motors.stopAllMotors()
motors.stopAll()
brick.showString("30 cm", 1)
```

View File

@ -9,39 +9,12 @@ These six activities require the LEGO® MINDSTORMS® Education EV3 Core Set (455
```codecard
[
{
"name": "Sound Machine",
"name": "Make A Sound Machine",
"description": "Create instruments with your EV3 Brick!",
"url":"/maker/sound-machine",
"cardType": "example",
"imageUrl": "/static/maker/sound-machine.png"
},
{
"name": "Sound Of Color",
"description": "Play different sounds based on the color",
"url":"/maker/sound-of-color",
"cardType": "example",
"imageUrl": "/static/maker/sound-of-color.png"
},
{
"name": "Security Gadget",
"description": "Raise the alarm when your brick is lifted!",
"url":"/maker/security-gadget",
"cardType": "example",
"imageUrl": "/static/maker/security-gadget.png"
},
{
"name": "Intruder Detector",
"description": "Raise the alarm when an intruder sneaks in",
"url":"/maker/intruder-detector",
"cardType": "example",
"imageUrl": "/static/maker/intruder-detector.png"
},
{
"name": "Puppet",
"description": "Build an automated puppet",
"url":"/maker/puppet",
"cardType": "example",
"imageUrl": "/static/maker/puppet.png"
"imageUrl": "/static/maker/sound-machine.png",
"cardType": "side"
}
]
```

View File

@ -3,7 +3,7 @@
```namespaces
brick.showMood(moods.sleeping);
sensors.color(null);
motors.stopAllMotors();
motors.stopAll();
```
## See Also

View File

@ -12,7 +12,7 @@ motors.largeA.setInverted(true)
motors.largeA.setRegulated(false)
motors.largeA.stop()
motors.largeA.reset()
motors.stopAllMotors()
motors.stopAll()
```
## Counters

View File

@ -3,7 +3,7 @@
Stops all motors currently running on the brick.
```sig
motors.stopAllMotors();
motors.stopAll();
```
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.
@ -15,7 +15,7 @@ Tank the @boardname@ forward at half speed for 5 seconds and then stop.
```blocks
motors.largeAB.tank(50, 50);
loops.pause(5000);
motors.stopAllMotors();
motors.stopAll();
```
## See also

View File

@ -76,7 +76,7 @@ for (let i = 0; i < 4; i++) {
motors.largeBC.steer(-30, 30)
loops.pause(5000)
}
motors.stopAllMotors()
motors.stopAll()
```
## See also

View File

@ -46,7 +46,7 @@ motors.largeAB.tank(75, 75)
loops.pause(10000)
motors.largeAB.tank(-55, -55)
loops.pause(10000)
motors.stopAllMotors()
motors.stopAll()
```
### Slip steer
@ -73,7 +73,7 @@ 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()
motors.stopAll()
```
## See also

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
docs/static/lessons/make-a-system.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

BIN
docs/static/lessons/make-it-move.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

BIN
docs/static/lessons/make-it-smarter.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 KiB

BIN
docs/static/lessons/try.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
docs/static/lessons/use.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

View File

@ -73,7 +73,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
<span class="ui blue circular label">2</span>
<strong>${lf("Make sure you have the latest EV3 firmware")}</strong>
<br/>
<a href="" target="_blank">${lf("Click here to update to latest firmware")}</a>
<a href="https://ev3manager.education.lego.com/" target="_blank">${lf("Click here to update to latest firmware")}</a>
</div>
</div>
</div>

34
libs/base/enums.d.ts vendored Normal file
View File

@ -0,0 +1,34 @@
// 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 Normal file
View File

@ -0,0 +1,159 @@
// 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.

View File

@ -161,7 +161,7 @@ namespace brick {
// this needs to be done in query(), which is run without the main JS execution mutex
// otherwise, while(true){} will lock the device
if (ret & DAL.BUTTON_ID_ESCAPE) {
motors.stopAllMotors(); // ensuring that all motors are off
motors.stopAll(); // ensuring that all motors are off
control.reset()
}
return ret

29
libs/core/enums.d.ts vendored Normal file
View File

@ -0,0 +1,29 @@
// Auto-generated. Do not edit.
/**
* Mode for lseek()
*/
declare const enum SeekWhence {
Set = 0,
Current = 1,
End = 2,
}
/**
* Drawing modes
*/
declare const enum Draw {
Normal = 0x00,
Clear = 0x01,
Xor = 0x02,
Fill = 0x04,
Transparent = 0x08,
Double = 0x10,
Quad = 0x20,
}
// Auto-generated. Do not edit. Really.

View File

@ -113,8 +113,8 @@ namespace motors {
//% blockId=motorStopAll block="stop all motors"
//% weight=1
//% group="Move"
//% help=motors/stop-all-motors
export function stopAllMotors() {
//% help=motors/stop-all
export function stopAll() {
const b = mkCmd(Output.ALL, DAL.opOutputStop, 0)
writePWM(b)
}

144
libs/core/shims.d.ts vendored Normal file
View File

@ -0,0 +1,144 @@
// Auto-generated. Do not edit.
declare namespace control {
/** Create new file mapping in memory */
//% shim=control::mmap
function mmap(filename: string, size: int32, offset: int32): MMap;
}
declare interface MMap {
/**
* Write a number in specified format in the buffer.
*/
//% shim=MMapMethods::setNumber
setNumber(format: NumberFormat, offset: int32, value: number): void;
/**
* Read a number in specified format from the buffer.
*/
//% shim=MMapMethods::getNumber
getNumber(format: NumberFormat, offset: int32): number;
/**
* Read a range of bytes into a buffer.
*/
//% offset.defl=0 length.defl=-1 shim=MMapMethods::slice
slice(offset?: int32, length?: int32): Buffer;
/** Returns the length of a Buffer object. */
//% property shim=MMapMethods::length
length: int32;
/** Perform ioctl(2) on the underlaying file */
//% shim=MMapMethods::ioctl
ioctl(id: uint32, data: Buffer): int32;
/** Perform write(2) on the underlaying file */
//% shim=MMapMethods::write
write(data: Buffer): int32;
/** Perform read(2) on the underlaying file */
//% shim=MMapMethods::read
read(data: Buffer): int32;
/** Set pointer on the underlaying file. */
//% shim=MMapMethods::lseek
lseek(offset: int32, whence: SeekWhence): int32;
}
declare namespace control {
/**
* Announce that an event happened to registered handlers.
* @param src ID of the Component that generated the event
* @param value Component specific code indicating the cause of the event.
* @param mode optional definition of how the event should be processed after construction.
*/
//% weight=21 blockGap=12 blockId="control_raise_event"
//% block="raise event|from %src|with value %value" blockExternalInputs=1 shim=control::raiseEvent
function raiseEvent(src: int32, value: int32): void;
/**
* Allocates the next user notification event
*/
//% help=control/allocate-notify-event shim=control::allocateNotifyEvent
function allocateNotifyEvent(): int32;
/** Write data to DMESG debugging buffer. */
//% shim=control::dmesg
function dmesg(s: string): void;
}
declare namespace serial {
/** Send DMESG debug buffer over serial. */
//% shim=serial::writeDmesg
function writeDmesg(): void;
}
declare namespace screen {
/** Decompresses a 1-bit gray scale PNG image to image format. */
//% shim=screen::unpackPNG
function unpackPNG(png: Buffer): Image;
}
declare namespace screen {
/** Clear screen and reset font to normal. */
//% shim=screen::clear
function clear(): void;
/** Makes an image bound to a buffer. */
//% shim=screen::imageOf
function imageOf(buf: Buffer): Image;
}
//% fixedInstances
declare interface Image {
/** Returns the underlaying Buffer object. */
//% property shim=ImageMethods::buffer
buffer: Buffer;
/** Returns the width of an image. */
//% property shim=ImageMethods::width
width: int32;
/** Returns the height of an image. */
//% property shim=ImageMethods::height
height: int32;
/** Double size of an image. */
//% shim=ImageMethods::doubled
doubled(): Image;
/** Draw an image on the screen. */
//% shim=ImageMethods::draw
draw(x: int32, y: int32, mode: Draw): void;
}
declare namespace output {
/**
* Create a new zero-initialized buffer.
* @param size number of bytes in the buffer
*/
//% shim=output::createBuffer
function createBuffer(size: int32): Buffer;
}
declare namespace motors {
/**
* Mark a motor as used
*/
//% shim=motors::__motorUsed
function __motorUsed(port: int32, large: boolean): void;
}
declare namespace sensors {
/**
* Mark a sensor as used
*/
//% shim=sensors::__sensorUsed
function __sensorUsed(port: int32, type: int32): void;
}
// Auto-generated. Do not edit. Really.

56
libs/music/shims.d.ts vendored Normal file
View File

@ -0,0 +1,56 @@
// Auto-generated. Do not edit.
declare namespace music {
/**
* Set the output volume of the sound synthesizer.
* @param volume the volume 0...100, eg: 50
*/
//% weight=96
//% blockId=synth_set_volume block="set volume %volume"
//% parts="speaker" blockGap=8
//% volume.min=0 volume.max=100
//% help=music/set-volume
//% weight=1 shim=music::setVolume
function setVolume(volume: int32): void;
/**
* Play a tone through the speaker for some amount of time.
* @param frequency pitch of the tone to play in Hertz (Hz)
* @param ms tone duration in milliseconds (ms)
*/
//% help=music/play-tone
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
//% parts="headphone" async
//% blockNamespace=music
//% weight=76 blockGap=8 shim=music::playTone
function playTone(frequency: int32, ms: int32): void;
/**
* Play a tone through the speaker for some amount of time.
*/
//% help=music/stop-all-sounds
//% blockId=music_stop_all_sounds block="stop all sounds"
//% parts="headphone"
//% blockNamespace=music
//% weight=97 shim=music::stopAllSounds
function stopAllSounds(): void;
/** Makes a sound bound to a buffer in WAV format. */
//% shim=music::fromWAV
function fromWAV(buf: Buffer): Sound;
}
//% fixedInstances
declare interface Sound {
/** Returns the underlaying Buffer object. */
//% property shim=SoundMethods::buffer
buffer: Buffer;
/** Play sound. */
//% promise shim=SoundMethods::play
play(): void;
}
// Auto-generated. Do not edit. Really.

17
libs/storage/shims.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
// Auto-generated. Do not edit.
declare namespace storage {
/** Will be moved. */
//% shim=storage::__stringToBuffer
function __stringToBuffer(s: string): Buffer;
/** Will be moved. */
//% shim=storage::__bufferToString
function __bufferToString(s: Buffer): string;
/** Create named directory. */
//% shim=storage::__mkdir
function __mkdir(filename: string): void;
}
// Auto-generated. Do not edit. Really.

View File

@ -3,10 +3,10 @@ tests.onEvent(TestEvent.RunSetUp, function() {
console.sendToScreen();
})
tests.onEvent(TestEvent.TestSetUp, function() {
motors.stopAllMotors();
motors.stopAll();
motors.resetAllMotors();
})
tests.onEvent(TestEvent.TestTearDown, function() {
motors.stopAllMotors();
motors.stopAll();
motors.resetAllMotors();
})

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.0.99",
"version": "0.0.101",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "pxt-ev3",
"version": "0.0.99",
"version": "0.0.101",
"description": "LEGO Mindstorms EV3 for Microsoft MakeCode",
"private": true,
"keywords": [
@ -21,6 +21,7 @@
"files": [
"README.md",
"pxtarget.json",
"targetconfig.json",
"built/*.js",
"built/*.json",
"built/*.d.ts",
@ -44,8 +45,8 @@
"webfonts-generator": "^0.4.0"
},
"dependencies": {
"pxt-common-packages": "0.19.1",
"pxt-core": "3.4.1"
"pxt-common-packages": "0.19.4",
"pxt-core": "3.4.3"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"

View File

@ -38,7 +38,7 @@
"packages": true,
"sharing": true,
"publishing": true,
"importing": false,
"importing": true,
"preferredPackages": [],
"githubPackages": true
},
@ -163,5 +163,5 @@
"editor.background": "#ecf6ff"
}
},
"ignoreDocsErrors": false
"ignoreDocsErrors": true
}

View File

@ -8,8 +8,9 @@
]
},
"galleries": {
"Maker Activities": "maker",
"Coding Activites": "coding",
"Lessons": "lessons"
"Getting Started": "getting-started",
"Design Engineering": "design-engineering",
"Coding": "coding",
"Maker": "maker"
}
}