Compare commits

..

75 Commits

Author SHA1 Message Date
5843deab11 1.1.7 2019-08-28 11:39:18 -07:00
8d5edc38bb bump common version (#885) 2019-08-28 11:30:59 -07:00
0309e50058 1.1.6 2019-08-28 08:52:24 -07:00
aa40e7b169 Endprogram (#884)
* moving end program logic to c++

* typo

* always stop on reset
2019-08-28 08:52:01 -07:00
75cf8da396 1.1.5 2019-08-27 17:57:44 -07:00
Max
db9b6a995b IIC added (#870)
* IIC added

* Fixed bug with not detecting device
2019-08-27 17:57:21 -07:00
fb255edafe 1.1.4 2019-08-27 17:28:57 -07:00
f4c39f74e8 1.1.3 2019-08-27 17:05:49 -07:00
3e56e2c3e2 Rgb raw tuning of blocs (#883)
* refactor blocks

* make non-private
2019-08-27 17:05:16 -07:00
79b5f8cc88 Add rgb and reflection raw mods for color sensor (#876)
* Add reflection raw value

Add reflection raw value for color sensor

* update

* Combined rgbraw and refraw
2019-08-27 16:45:12 -07:00
312729142f 1.1.2 2019-08-27 16:42:36 -07:00
Max
5bd4aed0e1 Multiple sensors 2 (#877)
* Fixed -1 mode in libs

* Deleted todo
2019-08-27 16:34:55 -07:00
cfaa4ae3ef migrate build to travis 2019-08-27 16:29:18 -07:00
faa839d59f 1.1.1 2019-08-27 16:26:37 -07:00
630687bfce bump to 1.1 2019-08-27 16:26:19 -07:00
2b300a4094 Maximmasterr set settle (#882)
* Added set settle time

* updated blocks
2019-08-27 14:57:28 -07:00
5fb8c0de6e delete package-lock.json 2019-08-27 14:45:25 -07:00
1f65cd59a8 Fixes to "Line Following in Loop" Sample Solutions (#871)
Sample Solutions were wrong for both Methods of Line Following in a Loop
2019-08-27 14:27:20 -07:00
fd75bb61d6 Fix typos in sample programme description (#872)
1500 milliseconds is not one quarter of a second - fixed the text to reflect.
2019-08-06 14:50:19 -07:00
Max
4d2f72575b Fixed multiple sensor bug (#868) 2019-07-15 15:26:25 -07:00
1fe3d3e01a plug in offline page (#836) 2019-03-07 19:40:21 -08:00
0c6e65d828 Updateing Trademark in readme (#834)
* Updateing Trademark in readme

* Removed chat reference
2019-03-04 16:39:23 -08:00
ae9c0603f2 Releasing electron 1.0.11 (#832) 2018-12-06 10:16:17 -08:00
06aeca228a Updating offline-app.html to right version (#833) 2018-12-06 10:15:40 -08:00
31fd4799a5 Hot fix release (v1.0.11) (#831)
* Hot fix release (v1.0.10)
2018-12-04 13:24:06 -08:00
7d8e6891ee 1.0.11 2018-12-04 13:03:59 -08:00
462234b1c0 Re-enable trace from simulator configuration (#830) 2018-12-04 13:03:34 -08:00
dad1bd0cd4 1.0.10 2018-12-03 16:38:08 -08:00
b71bfef418 Call setOutputType with the right arguments (#828)
* Call setOutputType with the right arguments
2018-12-03 16:37:53 -08:00
2e0a34c99b Calibration states (#820)
* color calibration
2018-12-03 16:37:40 -08:00
4133828a10 Update the join up link to the FLL Slack channel (#824) 2018-11-19 19:49:46 -08:00
f0c19bc976 Add LEGO video links to FLL page (#822) 2018-11-12 12:20:37 -08:00
a09b4a083f FLL page changes/add-ons (#821) 2018-11-12 12:02:19 -08:00
15dff9af08 Update fll.md 2018-11-12 07:49:04 -08:00
6fa5c1b688 Update fll.md 2018-11-12 07:47:31 -08:00
d76cea1477 1.0.9 2018-11-06 09:08:51 -08:00
ca09a0a833 Add file delete workaround to 'FLL' page (#816) 2018-11-06 09:08:14 -08:00
fcc864823e Use single sentence 'getting-started' card (#817) 2018-11-05 18:04:42 -08:00
166dc27b93 Add FLL page to SUMMARY (#815) 2018-11-01 17:38:21 -07:00
66e50473c4 FLL info page (#814) 2018-11-01 07:46:43 -07:00
58452e1ca3 Fix for missing CAPS in certain parts of EULA 2018-10-26 09:13:03 -07:00
2b7498ea2d Updating new EULA from legal (#813) 2018-10-26 09:09:11 -07:00
5ab2b97663 Remove titles from videos in homescreen (#812) 2018-10-23 08:44:02 -07:00
ffe0f0fb32 Enable tracing from simulator to appTheme (#810) 2018-10-17 11:33:18 -07:00
f27d13f88e Updating offline docs to new release 1.0.8 (#808) 2018-09-26 16:26:35 -07:00
31067dcef8 enable light toc 2018-09-26 16:13:15 -07:00
123f6c84b2 Release electron for auto update (#807)
This will enable auto update of the packages
2018-09-26 16:11:42 -07:00
c5f07ca67c removing light toc 2018-09-26 15:43:20 -07:00
22fc7dee18 added lighttoc 2018-09-26 15:42:28 -07:00
1f58b649c5 Release of 1.0.8 to live (#806)
Beta->release
2018-09-26 15:41:03 -07:00
fc75fe8e16 fixed video title 2018-09-26 11:31:24 -07:00
b399c37527 adding videos page to home 2018-09-26 11:28:32 -07:00
a054fdd3d3 1.0.8 2018-09-25 16:58:51 -07:00
a239589913 Move back to 4.0.9 2018-09-25 16:58:40 -07:00
98a046237c bump pxt-core to 4.1.1, 2018-09-25 16:56:45 -07:00
eb385ec532 1.0.7 2018-09-25 10:28:59 -07:00
2fdce16685 Update field motors editor to support localized languages (#803)
* Use the value for options, and hardcode localized versions of first dropdown
2018-09-25 10:28:34 -07:00
74eb77a9ae 1.0.6 2018-09-25 08:42:24 -07:00
4fba96588f Bumping pxt-core to 4.0.8 2018-09-25 07:56:19 -07:00
03c07bdcf5 1.0.5 2018-09-21 20:00:18 -07:00
6da1bc3cb1 bump pxt 2018-09-21 18:49:39 -07:00
dfc9ca1db4 fxing leading / in docs 2018-09-21 14:07:11 -07:00
83b64c1e54 1.0.4 2018-09-21 11:25:26 -07:00
a0cf8655f2 updated pxt 2018-09-21 11:25:13 -07:00
e4cf2c99c0 removoing lightToc 2018-09-21 11:07:04 -07:00
076fb8487e 1.0.3 2018-09-21 09:41:31 -07:00
c725561389 bump pxt 2018-09-21 09:41:19 -07:00
3dc781f4fd remove docs in image paths 2018-09-21 09:38:48 -07:00
4456767f2d Change tables to bullet lists for docs (#789) 2018-09-20 17:07:38 -07:00
6dba240899 1.0.2 2018-09-20 14:24:19 -07:00
d7172a1f3a Light theme docs (#786)
* lighttheme toc

* use LEGO edu logo everywhere

* bump pxt
2018-09-20 14:23:08 -07:00
245ff9d5b2 Adding link instructions (#787) 2018-09-20 14:05:59 -07:00
bfb258ce61 Add 'Explorer' section to editor features page (#785) 2018-09-20 07:35:24 -07:00
63beb2cac7 missing github logo 2018-09-19 21:26:35 -07:00
73d3dce139 missing comma 2018-09-19 16:16:37 -07:00
55 changed files with 861 additions and 5064 deletions

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
language: node_js
node_js:
- "8.9.0"
script:
- "node node_modules/pxt-core/built/pxt.js travis"
sudo: false
cache:
directories:
- node_modules

View File

@ -4,9 +4,6 @@
This repo contains the editor target hosted at https://makecode.mindstorms.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
## Local Dev setup
These instructions assume familiarity with dev tools and languages.
@ -63,6 +60,9 @@ https://ci2.dot.net/job/Private/job/pxt_project_rainbow/job/master/
## License
MIT
## Trademarks
MICROSOFT, the Microsoft Logo, and MAKECODE are registered trademarks of Microsoft Corporation. They can only be used for the purposes described in and in accordance with Microsofts Trademark and Brand guidelines published at https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general.aspx. If the use is not covered in Microsofts published guidelines or you are not sure, please consult your legal counsel or the MakeCode team (makecode@microsoft.com).
## Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

View File

@ -5,6 +5,7 @@
* [Troubleshoot](/troubleshoot)
* [EV3 Manager](https://ev3manager.education.lego.com/)
* [LEGO Support](https://www.lego.com/service/)
* [FIRST LEGO League](/fll)
## Projects #projects
@ -82,12 +83,12 @@
* [reset](/reference/sensors/gyro/reset)
* [Ultrasonic](/reference/sensors/ultrasonic)
* [on event](/reference/sensors/ultrasonic/on-event)
* [distance](reference/sensors/ultrasonic/distance)
* [pause until](reference/sensors/ultrasonic/pause-until)
* [distance](/reference/sensors/ultrasonic/distance)
* [pause until](/reference/sensors/ultrasonic/pause-until)
* [Infrared](/reference/sensors/infrared)
* [on event](/reference/sensors/infrared/on-event)
* [distance](reference/sensors/infrared/proximity)
* [pause until](reference/sensors/infrared/pause-until)
* [distance](/reference/sensors/infrared/proximity)
* [pause until](/reference/sensors/infrared/pause-until)
* [Infrared beacon](/reference/sensors/beacon)
* [on event](/reference/sensors/beacon/on-event)
* [pause until](/reference/sensors/beacon/pause-until)

View File

@ -70,3 +70,12 @@
| ![Download button](/static/about/download-button.png) |
| Download Button |
#### #explorer-images
| |
|-|
| ![Explorer button](/static/about/explorer-button.png) |
| Explorer Button |
|   |
| ![Explorer File View](/static/about/explorer-view.png) |
| Explorer File View |

View File

@ -12,7 +12,7 @@ Design cars that can park themselves safely without driver intervention.
* What would it take to ensure that autonomous cars are safe?
* What types of movements do autonomous cars need to perform?
## Construct
## Construct
### Build
@ -20,6 +20,12 @@ Build a @boardname@ vehicle that can park itself safely without driver intervent
[![EV3- Robot Driving Base](/static/coding/autonomous-parking/ev3-robot-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Check
Before you program, check:
@ -28,7 +34,7 @@ Before you program, check:
* Are the wheels correctly installed?
* Are the wheels rotating freely?
### Program
### Program
Write a program that will make the robot turn three times in various ways.
@ -109,7 +115,7 @@ Click Download and follow the instructions to get your code onto your EV3 Brick.
### Differentiation
Create a program that simulates displaying appropriate warning lights while parking.
Create a program that simulates displaying appropriate warning lights while parking.
### ~hint
@ -164,8 +170,8 @@ Click Download and follow the instructions to get your code onto your EV3 Brick.
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds from the Brick or Music menus.
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -24,6 +24,12 @@ Build red and green “lights” for your robot to detect. You can use LEGO bric
[![IMAGE: Color Squares](/static/coding/line-detection/ev3-color-squares.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/color%20squares-0a88dfd98bb2e64b5b8151fc422bae36.pdf)
### ~hint
If clicking the above images doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Check
Before you program, check:
@ -51,7 +57,7 @@ Consider using these blocks in your solution:
```block
loops.forever(function () {
})
motors.largeBC.steer(0, 50)
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Red)
@ -77,9 +83,9 @@ loops.forever(function () {
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
Congratulations! Your robot can stop at a red light.
Congratulations! Your robot can stop at a red light.
Now add to your program and have your robot to drive forward again when the light changes from red to green.
@ -102,7 +108,7 @@ loops.forever(function () {
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
## Contemplate
@ -116,7 +122,7 @@ Draw a dark line with tape or marker for your robot to cross.
Consider using these blocks in your solution:
```block
```block
motors.largeBC.steer(0, 50)
music.playSoundEffect(sounds.systemGeneralAlert)
```
@ -143,7 +149,7 @@ loops.forever(function () {
#### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
#### Differentiation
@ -157,7 +163,7 @@ Consider using these blocks in your solution:
```block
while (true) {
}
motors.largeBC.steer(0, 50)
```
@ -166,7 +172,7 @@ motors.largeBC.steer(0, 50)
```block
if (true) {
} else {
}
@ -184,12 +190,10 @@ if (true) {
```blocks
forever(function () {
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Black)
while (sensors.color3.color() == ColorSensorColor.Black) {
motors.largeBC.steer(-30, 50)
}
while (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.White)
while (sensors.color3.color() == ColorSensorColor.White) {
motors.largeBC.steer(30, 50)
}
})
@ -203,11 +207,9 @@ Else the Color Sensor detects the color white, start motors ``B`` and ``C`` (dri
```blocks
forever(function () {
if (true) {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.Black)
if (sensors.color3.color() == ColorSensorColor.Black) {
motors.largeBC.steer(-30, 50)
} else {
sensors.color3.pauseUntilColorDetected(ColorSensorColor.White)
motors.largeBC.steer(30, 50)
}
})
@ -215,7 +217,7 @@ forever(function () {
### Download and test
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
Click **Download** and follow the instructions to get your code onto your EV3 Brick.
### Share
@ -232,8 +234,8 @@ Personalize:
* Click on the **JavaScript** tab and experiment with changing the values in the code.
* Add a custom image or sounds from the ``||brick:Brick||`` or ``||music:Music||`` menus.
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -4,7 +4,7 @@ Design ways to avoid accidents between vehicles and objects in the road.
![Deer in the road](/static/coding/object-detection/road-deer.jpg)
## Connect
## Connect
Think about:
@ -12,7 +12,7 @@ Think about:
* What do you need to be aware of to avoid collisions with obstacles?
* What causes traffic jams in high density areas?
## Construct
## Construct
### Build
@ -20,10 +20,16 @@ Build a @boardname@ vehicle that can avoid accidents between vehicles and object
[![EV3 Robot Driving Base](/static/coding/object-detection/ev3-robot-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-ultrasonic-sensor-driving-base-61ffdfa461aee2470b8ddbeab16e2070.pdf)
Build an obstacle for your robot to detect. You can build the **cuboid model** out of LEGO bricks or an obstacle of your choice.
Build an obstacle for your robot to detect. You can build the **cuboid model** out of LEGO bricks or an obstacle of your choice.
[![Cubiod block](/static/coding/object-detection/ev3-cuboid.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-cuboid-dc93b2e60bed2981e76b3bac9ea04558.pdf)
### ~hint
If clicking the above images doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
### Check
Before you program, check:
@ -38,7 +44,7 @@ Before you program, check:
* Program your robot to detect any obstacles that might appear while the robot is moving forward (or backward).
* Make the robot stop when it detects an object that is less than 20 cm away.
Before you program, think about:
Before you program, think about:
* How will you program the robot to detect obstacles?
* How will you program the robot to stop at obstacles?
* Which programming blocks will you use?
@ -59,7 +65,7 @@ motors.stopAll()
### ~
### Sample Solution
### Sample Solution
1. Start the program when EV3 ``enter`` button is pressed.
2. Turn motors ``B`` and ``C`` on at speed ``50``.
@ -80,7 +86,7 @@ Click **Download** and follow the instructions to get your code onto your EV3 Br
## Contemplate
On the road, when a driver sees and object, they slow their car down before coming to a full stop.
On the road, when a driver sees and object, they slow their car down before coming to a full stop.
Program your EV3 Driving Base to do the same.
@ -93,7 +99,7 @@ If the Ultrasonic Sensor:
### ~hint
Consider using this block in your solution:
```block
if (true) {
}
@ -101,7 +107,7 @@ if (true) {
### ~
### Sample Solution
### Sample Solution
```blocks
loops.forever(function () {
@ -118,7 +124,7 @@ loops.forever(function () {
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the ``center`` button on the EV3 Brick to run the program.
## Continue
## Continue
* Get together with other building teams and make a traffic jam by placing all of your robots in a line with varying amounts of space between them.
* Have everyone start their robots at the same time and see what happens.
@ -130,8 +136,8 @@ Click **Download** and follow the instructions to get your code onto your EV3 Br
* Share what you think “efficiency in programming” means.
* Explore the different solutions other programmers came up with.
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
* Create a video of your project, especially your final presentation and your robots performance. Explain some important features of your software program.
* Include an image of your program with comments.
* Add a team photograph!
Congratulations! What will you design next?

View File

@ -1,6 +1,6 @@
# Make A System That Communicates
## Connect
## Connect
### Design Brief
@ -20,10 +20,10 @@ Think about:
* What kind of motorized mechanism can be used to control the movements of a robot?
* How can the robot sense where it is along the path?
* How can the robot communicate its position?
![EV3 + LEGO Bricks](/static/lessons/make-it-communicate/ev3-plus-parts.jpg)
## Construct
## Construct
### Build
@ -37,13 +37,19 @@ More building ideas:
[![Color Sensor 2](/static/lessons/make-it-communicate/ev3-color-sensor2.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/color%20sensor_v2-e7fd54b6fa3cdfe36f414c1d2510f9cb.pdf)
### ~hint
Build a path for your robot to follow. You can use electrical tape on a floor, or marker on paper. You can use objects as milestones to indicate a path that can be detected by either the Touch Sensor, Color Sensor, or Ultrasonic Sensor.
If clicking the above images doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### Program
### ~
Build a path for your robot to follow. You can use electrical tape on a floor, or marker on paper. You can use objects as milestones to indicate a path that can be detected by either the Touch Sensor, Color Sensor, or Ultrasonic Sensor.
### Program
Before you program, think about:
Before you program, think about:
* How will you program the robot to follow a path?
* How will you program the robot to communicate its position?
* Which programming blocks will you use?
@ -54,7 +60,7 @@ Explore the different Motor and Sensor blocks in the programming menu.
### ~
### Sample Solution
### Sample Solution
[![Video: EV3 Track Rover](/static/lessons/make-it-communicate/ev3-track-rover.jpg)](https://legoeducation.23video.com/v.ihtml/player.html?token=79c99735f906403a4dd7f2909935983d&source=embed&photo%5fid=19857954)
@ -70,15 +76,21 @@ Two copies of the tracks are built: one for the right side and a mirror image fo
[![Track rover assembled](/static/lessons/make-it-communicate/ev3-track-rover2.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/ev3-dep/building%20instructions/track-rover-bi-6aadb1b053df0c58a0dea108b5ce0eea.pdf)
### Sample Program Solution
### ~hint
This program works with the Track Rover. If you create a different robot, adjust the program to fit your solution.
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
Program summary:
### ~
### Sample Program Solution
This program works with the Track Rover. If you create a different robot, adjust the program to fit your solution.
Program summary:
* If the Color Sensor sees black, Motor B runs at -50 power and Motor C turns off.
* If the Color Sensor sees white, Motor B turns off and Motor C runs at -50 power.
* If the Color Sensor sees green, all motors stop and the green sound plays.
* If the Color Sensor sees green, all motors stop and the green sound plays.
* The robot waits one second, then motors move forward.
* If the Color Sensor sees red, all motors stop, and the red sound plays.
* The robot waits one second, then motors move forward.
@ -108,44 +120,44 @@ forever(function () {
Click Download and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
## Contemplate
### Test and Analyze
### Test and Analyze
As you work on your solution:
1. Describe one part of your design that worked especially well.
2. Describe one design change that you had to make.
3. What will you try next?
1. Describe one part of your design that worked especially well.
2. Describe one design change that you had to make.
3. What will you try next?
### Review and Revise
### Review and Revise
Take a moment to reflect on your robot solution.
Take a moment to reflect on your robot solution.
Think about:
* Can the robots movement be more accurate?
* Can the robots movement be more accurate?
* What are some ways that others have solved the problem?
Describe two ways you could improve your robot.
## Continue
## Continue
### Personalize your project
* Add/remove LEGO elements to improve the way your robot moves.
* Add/remove LEGO elements to improve the way your robot moves.
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds by adding blocks from the Brick or Music menus.
## Communicate
## 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!
* 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!
Congratulations! What will you design next?

View File

@ -32,18 +32,24 @@ If you want some building help you can follow these instructions.
Click [here](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/toddle%20bot-3dcad146d7f5deac4753f93e9dcc0739.pdf)
### ~hint
If clicking the above image or link doesn't open the instructions, right-click on the link and choose "Save link as..." to download the PDF.
### ~
### Program
Before you program, think about:
* How will you program the robot to move?
* How will you program the robot to move?
* How will you program the robot to stop?
* How will you program the robot to display the distance moved?
Which programming blocks will you use:
* To turn on and turn off the motor or motors?
* To display the distance moved?
* To turn on and turn off the motor or motors?
* To display the distance moved?
### Sample Code
@ -51,7 +57,7 @@ Example code of a robot that moves without wheels using one motor:
* The robot moves with ``large motor D`` rotating at ``-100`` speed
* The robot moves for ``30000`` milliseconds (30 seconds)
* The robot stops
* The robot stops
* The robot displays the text ``"30cm"``
```blocks
@ -67,7 +73,7 @@ brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
## Contemplate
### Test and Analyze

View File

@ -1,6 +1,6 @@
# Make It Smarter and Faster
# Make It Smarter and Faster
## Connect
## Connect
### Design Brief
@ -10,52 +10,52 @@ https://www.youtube.com/watch?v=y9-A_C_08KY
* What do the robots in the video need to be able to sense, plan, and act?
* What senses do humans have and why are they important to us?
* How many human-like senses do you see the robots demonstrating?
* How many human-like senses do you see the robots demonstrating?
### Brainstorm
### Brainstorm
Discuss different solutions to the design brief.
Think about:
Think about:
* What kind of creature can it be?
* How can it move?
* What does it need to be aware so that it stays safe, well fed and warm (or cool)?
* Is it looking for food, a safe place to hide or a warm place to soak up the sun?
* Will the creature need to move fast or slow?
* Will it need to turn?
* What kind of creature can it be?
* How can it move?
* What does it need to be aware so that it stays safe, well fed and warm (or cool)?
* Is it looking for food, a safe place to hide or a warm place to soak up the sun?
* Will the creature need to move fast or slow?
* Will it need to turn?
* Will it need to go backward?
![EV3 and bricks](/static/lessons/make-it-smarter/bricks.png)
## Construct
### Build
Think about a creatures movement for inspiration. Your mechanism can be attached or unattached to the EV3 Brick. You can start by tinkering with the LEGO elements in the picture add then build on.
More building ideas:
More building ideas:
| | | | | |
|-|-|-|-|-|
|[![EV3 Frames](/static/lessons/make-it-smarter/ev3-parts-frames.jpg)][EV3 Frames] | |[![EV3 Color Sensor 1](/static/lessons/make-it-smarter/ev3-parts-color-sensor-1.jpg)][Color Sensor 1] | |[![EV3 Gyro Sensor](/static/lessons/make-it-smarter/ev3-parts-gyro-sensor.jpg)][Gyro Sensor] |
| [EV3 Frames] | | [Color Sensor 1] | | [Gyro Sensor] |
<br/>
| | | | | |
|-|-|-|-|-|
|[![EV3 Ultrasonic Sensor](/static/lessons/make-it-smarter/ev3-parts-ultrasonic-sensor.jpg)][Ultrasonic Sensor] | | [![EV3 Touch Sensor](/static/lessons/make-it-smarter/ev3-parts-touch-sensor.jpg)][Touch Sensor] | | [![EV3 Gyro Sensor](/static/lessons/make-it-smarter/ev3-parts-jaw.jpg)][Jaw] |
| [Ultrasonic Sensor] | | [Touch Sensor] | | [Jaw] |
<br/>
* [EV3 Frames]
* [Color Sensor 1]
* [Gyro Sensor]
* [Ultrasonic Sensor]
* [Touch Sensor]
* [Jaw]
* [Leg 1]
* [Leg 2]
* [Leg 3]
| | | | | |
|-|-|-|-|-|
| [![EV3 Leg 1](/static/lessons/make-it-smarter/ev3-parts-leg-1.jpg)][Leg 1] | | [![EV3 Leg 2](/static/lessons/make-it-smarter/ev3-parts-leg-2.jpg)][Leg 2] | | [![EV3 Leg 3](/static/lessons/make-it-smarter/ev3-parts-leg-3.jpg)][Leg 3] |
| [Leg 1] | | [Leg 2] | | [Leg 3] |
### ~hint
### Program
If clicking the above links doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
Before you program, think about:
### ~
### Program
Before you program, think about:
* How will you program the robot to sense?
* How will you program the robot to respond?
@ -67,7 +67,7 @@ Before you program, think about:
### ~
### Sample Solution
### Sample Solution
The Insect uses its Ultrasonic Sensor to sense danger and move away from a threat.
@ -86,18 +86,24 @@ Building Instructions:
[![Insect robot](/static/lessons/make-it-smarter/insect-bot.jpg)](https://le-www-live-s.legocdn.com/sc/media/files/support/mindstorms%20ev3/building-instructions/design%20engineering%20projects/insect-94b8a46f0dc5082c9d78ddb734626dc9.pdf)
### Sample Solution
### ~hint
This program checks if the Ultrasonic Sensor senses something near.
If clicking the above images or links doesn't open the instructions, right-click on the link and choose "Save link as..." to download the PDF.
The blocks inside the ``||loops:forever||`` loop have these actions:
### ~
### Sample Solution
This program checks if the Ultrasonic Sensor senses something near.
The blocks inside the ``||loops:forever||`` loop have these actions:
1. Turn on the ``green`` EV3 Brick Status Light.
2. Wait for Ultrasonic Sensor to detect an object.
3. Turn on Motors ``A`` and ``D`` in opposite directions.
4. Wait for one quarter of a second (``1500`` milli seconds).
4. Wait for one and a half seconds (``1500`` milli seconds).
5. Reverse the direction of Motors ``A`` and ``D``.
6. Wait for one quarter of a second.
6. Wait for one and a half seconds.
7. Stop all motors.
8. Make an insect chirping sound.
9. Loop continuously so that the insect wanders around when the Ultrasonic Sensor is detects something.
@ -119,44 +125,44 @@ forever(function () {
Click **Download** and follow the instructions to get your code onto your EV3 Brick. Press the center button on the EV3 Brick to run the program.
## Contemplate
## Contemplate
### Test and Analyze
### Test and Analyze
As you work on your solution:
1. Describe one part of your design that worked especially well.
2. Describe one design change that you had to make.
3. What will you try next?
As you work on your solution:
1. Describe one part of your design that worked especially well.
2. Describe one design change that you had to make.
3. What will you try next?
### Review and Revise
### Review and Revise
Take a moment to reflect on your robot solution.
Take a moment to reflect on your robot solution.
Think about:
Think about:
* Does your robot move when the sensor is activated?
* If not, what will you change to make the robots ability to sense and respond more obvious?
* What other behaviors can you add to the robot to make it more realistic?
* Does your robot move when the sensor is activated?
* If not, what will you change to make the robots ability to sense and respond more obvious?
* What other behaviors can you add to the robot to make it more realistic?
Describe two ways you could improve your robot.
## Continue
## Continue
Personalize your project:
* Add/remove LEGO elements to improve the way your robot moves.
* Add/remove LEGO elements to improve the way your robot moves.
* Click on the JavaScript tab and experiment with changing the values in the code.
* Add a custom image or sounds by adding blocks from the Brick or Music menus.
* Does your robot resemble a creature? Maybe add more craft materials to your project.
## Communicate
## Communicate
Here are some ideas:
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!
* 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!
Congratulations! What will you design next?

112
docs/fll.md Normal file
View File

@ -0,0 +1,112 @@
# MakeCode for _FIRST_ LEGO League
![FIRST LEGO League logo](/static/fll/fll-logo.png)
For teams participating in the Open Software Platform Pilot utilizing MakeCode, weve compiled a list of resources and information that we hope will be helpful for you.
## FAQ
### How do I use MakeCode with my EV3?
* You will need to install the latest EV3 firmware on your brick. Instructions on how to do that are located here: https://makecode.mindstorms.com/troubleshoot.
* You will need a computer with a USB port to connect to the EV3 in order to download your programs.
* You will need internet access and a browser on your computer to get to https://makecode.mindstorms.com.
### Whats the best way to get started with MakeCode?
Watch some of the videos at https://makecode.mindstorms.com (at the bottom of the page).
Try some of the provided tutorials:
* [Wake Up!](@homeurl@#tutorial:tutorials/wake-up) show your EV3 brick waking up
* [Animation](@homeurl@#tutorial:tutorials/make-an-animation) create a custom animation to show
* [Music Brick](@homeurl@#tutorial:tutorials/music-brick) transform your EV3 into a musical instrument
* [Run Motors](@homeurl@#tutorial:tutorials/run-motors) control the motors of your robot
* [Red Light, Green Light](@homeurl@#tutorial:tutorials/redlight-greenlight) play red light, green light with the color sensor
* [Line Following](@homeurl@#tutorial:tutorials/line-following) have your robot follow a line
### Can I load both LEGO MINDSTORMS EV3 Software and MakeCode programs onto my EV3?
Yes.
### How do I figure out what a block does?
You can right-click on any block and select “Help” in the context menu to open the documentation page describing what that block does.
![Select help in context menu for block](/static/fll/context-help.jpg)
### How do I program in JavaScript?
Click the **JavaScript** button at the top of the page to get to the JavaScript editor. Students can drag and drop code snippets from the Toolbox on the left, or type directly in the editor. You can switch back and forth between **Blocks** and **JavaScript** as you program.
![Coding in JavaScript](/static/fll/code-js.gif)
Also, watch the [Text-based Coding](https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=3513a83b87fe536b2dc512237465fd1b&source=embed&photo%5fid=35719471) video for more about coding using the JavaScript editor.
### How do I use the Simulator?
The Simulator will show the physical representation of your code blocks. For example, based on this code snippet, the Simulator will show the touch sensor on Port 1, and a large motor on Port D.
```blocks
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
motors.largeD.run(50)
})
```
![Simulator demonstration](/static/fll/simulator.gif)
Note that the Simulator is also interactive, so you can simulate inputs with any of the sensors.
See the video [Block-based Coding and Simulation](https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=629730c938e452f0fd7653fbc4708166&source=embed&photo%5fid=35719470) for more about using the simulator.
### How do I save my programs?
MakeCode will automatically save your recent projects in the browser. However, you can also save a copy of your project as a file on your computer:
* From the **Settings** menu, select **Save Project**
* This will download your program from the browser as a _lego-myproject.uf2_ file
![Save project menu selection](/static/fll/save-project.jpg)
* You can import your saved projects by clicking the Import button on the Home Page
![Import button on home screen](/static/fll/import-button.jpg)
### How do I share my programs?
You can share your projects by clicking on the **share** button in the top left of the screen. This will create a URL which you can send others to open and view your project.
![Share button in editor](/static/fll/share-button.jpg)
![Share button and dialogs demo](/static/fll/share-program.gif)
Sharing programs is also shown in the [Tips and Tricks](https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=5c594c2373367f7870196f519f3bfc7a&source=embed&photo%5fid=35719472) video.
### Why can't I delete my program (*.uf2) files from the Brick?
There's a bug in the firmware which prevents you from deleting the programs (``*.uf2`` files) from your EV3 Brick. There isn't a firmware update to fix this yet. As a workaround, you can temporarily downgrade your firmware version, delete the files, and then upgrade back to the version that works with MakeCode.
Follow these steps to downgrade your firmware version, delete the files, and uprgade back again:
1. Go into **EV3 LabVIEW** - if it's not installed get it [here](https://education.lego.com/en-us/downloads/mindstorms-ev3/software)
2. Plug in your EV3 Brick and start a new project
3. Go to the **Tools** menu in the upper right corner, select **Firmware Update**
4. In the **Firmware Update** dialog box, click on the **Show Details** button
5. From the **Available Firmware Files** list, select **EV3 Firmware V1.09E**
6. Click the **Update Firmware** button and wait for the update to complete
Now the firmware version on the EV3 Brick will be **V1.09E**. Also, in the process, the downgrade deleted all of the saved programs from the EV3 Brick. To continue to use MakeCode, the firmware version must be at **V1.10E** or above. So, the Brick firmware needs to be upgraded again. If you don't know or do remember how to do this, see the **Upgrade your @drivename@** section in the [troubleshooting](/troubleshoot) page.
For other common questions, try the FAQ page https://makecode.mindstorms.com/faq.
## Workarounds
1. Deleting Programs from the EV3 brick
>* Description: Unable to delete program files from the EV3 brick after downloading them
>* Status: LEGO Education team is working on a fix, no estimated date yet
## Community connection
For questions, issues, feedback and community for the Open Software Platform Pilot:
We are using a messaging service called **Slack**. Slack can be accessed via an app you download to your computer or mobile device, and via a web interface. For more information about Slack, click [here](https://slack.com/). Anyone in the pilot can participate by signing up with Slack first, and then clicking this [FIRST LEGO League Robot SW](https://fllrobotsw.slack.com/join/shared_invite/enQtNDgxOTQ5MDc2OTkyLTg2ZTRkYzQ4OGMyZTg1OTZmMDFhMWNlOTQ1OWRlNDdmNzNmMjlhMmZiM2M3OWUxYjU1ODEwY2FmODJkNjZkOTA) link to join the Slack workspace.

View File

@ -7,7 +7,7 @@
{
"name": "Prepare",
"imageUrl": "/static/lessons/firmware.png",
"description": "To use Microsoft MakeCode with your EV3 Brick, you will need to install the latest LEGO® MINDSTORMS® Education EV3 firmware. Follow these steps to make sure you're up to date and install the latest firmware if you need to.",
"description": "To use Microsoft MakeCode with your EV3 Brick, you will need to install the latest LEGO® MINDSTORMS® Education EV3 firmware.",
"label": "New? Start Here!",
"labelClass": "red ribbon large",
"url": "https://makecode.mindstorms.com/troubleshoot"

View File

@ -20,6 +20,12 @@ Build the robot driving base:
[![EV3 Driving Base](/static/lessons/common/ev3-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-driving-base-79bebfc16bd491186ea9c9069842155e.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
## Make It Move
**Code it:** Create a program that makes the Driving Base move forward and stop at the finish line, which is ``1`` meter away.
@ -68,6 +74,12 @@ Build and attach an Ultrasonic Sensor to your driving base:
[![EV3 Ultrasonic Sensor Driving Base Building Instructions Main Image](/static/lessons/common/ev3-ultrasonic-sensor-driving-base.jpg)](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-ultrasonic-sensor-driving-base-61ffdfa461aee2470b8ddbeab16e2070.pdf)
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
## Detect an Object
**Code it:** Create a program that moves the Driving Base and makes it stop ``6`` cm from the Cuboid.

View File

@ -1,3 +1,3 @@
{
"appref": "v0.4.2"
"appref": "v1.0.11"
}

View File

@ -3,7 +3,7 @@
## Objective
Design ways to improve driving safety by helping to prevent drivers from falling asleep and causing an accident.
![Car driving on highway](/static/lessons/line-detection/car-driving.jpg)
## Connect
@ -20,6 +20,12 @@ Think about what you have learned, then document it. Describe the problem in you
Start by constructing this model. Read the building instructions [here](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/building-instructions/ev3-rem-color-sensor-down-driving-base-d30ed30610c3d6647d56e17bc64cf6e2.pdf) first.
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
![Color sensor on the driving base](/static/lessons/line-detection/color-sensor-driving.jpg)
## Program
@ -44,13 +50,13 @@ Create a program that drives the robot forward until the Color Sensor sees red.
Place a ``||motors:steer large B+C||`` block from ``||motors:Motors||`` under ``||loops:on start||``. Change the speed to 20%.
```blocks
```blocks
motors.largeBC.steer(0, 20)
```
### Step 2
Place a ``||loops:while||`` loop block under ``||motors:steer large B+C||``.
Place a ``||loops:while||`` loop block under ``||motors:steer large B+C||``.
```blocks
motors.largeBC.steer(0, 20)
@ -61,7 +67,7 @@ while (true) {
### Step 3
Place a ``||sensors:pause until color detected||`` from ``||sensors:Sensors||`` inside the ``||loops:while||`` loop block. Change the color to red.
```blocks
motors.largeBC.steer(0, 20)
while (true) {
@ -99,7 +105,7 @@ Place a ``||loops:while||`` loop block under ``||loops:on start||``.
```blocks
while (true) {
}
```
@ -121,7 +127,7 @@ Place a ``||loops:while||`` loop block under the ``||motors:steer large B+C||``
while (true) {
motors.largeBC.steer(0, 20)
while (true) {
}
}
```
@ -141,7 +147,7 @@ while (true) {
### Step 6
Place a ``||motors:stop all motors||`` block under the ``||sensors:pause until color detected||`` block.
Place a ``||motors:stop all motors||`` block under the ``||sensors:pause until color detected||`` block.
```blocks
while (true) {
@ -165,7 +171,7 @@ while (true) {
motors.stopAll()
}
while (true) {
}
}
```
@ -177,7 +183,7 @@ Place a ``||sensors:pause unril color detected||`` block inside the new ``||loop
What do you think the program will do?
**Hint:** The motors will run until the Color Sensor detects the color red, then it will stop all motors. The motors will also run and not stop when the color sensor detects the color green.
```blocks
while (true) {
motors.largeBC.steer(0, 20)
@ -212,7 +218,7 @@ sensors.color3.pauseUntilColorDetected(ColorSensorColor.Yellow)
music.playSoundEffect(sounds.systemGeneralAlert)
}
while (true) {
while (true) {
while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(10)
motors.largeC.run(-10)
@ -235,7 +241,7 @@ You will need to constantly debug your program in order to make your robot trave
```blocks
while (true) {
while (true) {
while (true) {
sensors.color3.pauseUntilLightDetected(LightIntensityMode.Reflected, Light.Bright)
motors.largeB.run(10)
motors.largeC.run(-10)
@ -252,10 +258,10 @@ while (true) {
Consider the following questions:
1. What challenged you?
2. Where there any surprises?
1. What challenged you?
2. Where there any surprises?
3. How could you improve your program?
4. Could your program have been more streamlined?
4. Could your program have been more streamlined?
5. Have you used too many blocks?
6. Is there a more efficient way of building your program?
7. How could your program be used in real-world scenarios?

View File

@ -1,4 +1,4 @@
# Make It Move Without Wheels
# Make It Move Without Wheels
## Objective @unplugged
@ -24,7 +24,13 @@ The Walker Bot combines an EV3 Frame and two legs that are mirror-images to crea
The legs in the Walker Bot are designed to show how to change the rotary motion of a motor to reciprocating motion.
Start by reading [these](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/ev3-dep/building%20instructions/walker-bot-bi-180fc24f9298e1dd6201099627d43903.pdf) instructions first.
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
![@boardname@ Walker Bot](/static/lessons/make-it-move/walker-bot.jpg)

View File

@ -1,4 +1,4 @@
# Make It Move Without Wheels
# Make It Move Without Wheels
## Objective
@ -23,7 +23,13 @@ The Walker Bot combines an EV3 Frame and two legs that are mirror-images to crea
The legs in the Walker Bot are designed to show how to change the rotary motion of a motor to reciprocating motion.
Start by reading [these](https://le-www-live-s.legocdn.com/sc/media/lessons/mindstorms-ev3/ev3-dep/building%20instructions/walker-bot-bi-180fc24f9298e1dd6201099627d43903.pdf) instructions first.
### ~hint
If clicking the above image doesn't open the instructions, right-click on the image and choose "Save link as..." to download the PDF.
### ~
![@boardname@ Walker Bot](/static/lessons/make-it-move/walker-bot.jpg)

View File

@ -42,14 +42,12 @@ This activity uses sensor inputs. You may want to try the [Use](/getting-started
Follow the steps of the _Maker Design Process_ for this lesson:
| | |
|-|-|
| ![Paper sheet icon](/static/maker/design-process-icons/define-problem.png) | **Define the Problem** |
| ![Lightbulb icon](/static/maker/design-process-icons/brainstorming.png) | **Brainstorming** |
| ![Checkmark icon](/static/maker/design-process-icons/define-criteria.png) | **Define the Design Criteria** |
| ![Connector icon](/static/maker/design-process-icons/go-make.png) | **Go Make** |
| ![Redo icon](/static/maker/design-process-icons/review-revise.png) | **Review and Revise Your Solution** |
| ![Speaker icon](/static/maker/design-process-icons/communicate.png) | **Communicate Your Solution** |
* Define the Problem
* Brainstorming
* Define the Design Criteria
* Go Make
* Review and Revise Your Solution
* Communicate Your Solution
### Defining the Problem

View File

@ -41,14 +41,12 @@ This activity uses motor rotations and sensor inputs. You may want to try the [U
Follow the steps of the _Maker Design Process_ for this lesson:
| | |
|-|-|
| ![Paper sheet icon](/static/maker/design-process-icons/define-problem.png) | **Define the Problem** |
| ![Lightbulb icon](/static/maker/design-process-icons/brainstorming.png) | **Brainstorming** |
| ![Checkmark icon](/static/maker/design-process-icons/define-criteria.png) | **Define the Design Criteria** |
| ![Connector icon](/static/maker/design-process-icons/go-make.png) | **Go Make** |
| ![Redo icon](/static/maker/design-process-icons/review-revise.png) | **Review and Revise Your Solution** |
| ![Speaker icon](/static/maker/design-process-icons/communicate.png) | **Communicate Your Solution** |
* Define the Problem
* Brainstorming
* Define the Design Criteria
* Go Make
* Review and Revise Your Solution
* Communicate Your Solution
### Defining the Problem

View File

@ -388,12 +388,12 @@
}
function downloadWin64() {
// TODO: Keep this link up-to-date with the desired release version
window.open("https://makecode.com/api/release/ev3/v0.4.2/win64");
window.open("https://makecode.com/api/release/ev3/v1.0.11/win64");
tickEvent("offlineapp.download", { "target": "ev3", "platform": "win64" });
}
function downloadMac64() {
// TODO: Keep this link up-to-date with the desired release version
window.open("https://makecode.com/api/release/ev3/v0.4.2/mac64");
window.open("https://makecode.com/api/release/ev3/v1.0.11/mac64");
tickEvent("offlineapp.download", { "target": "ev3", "platform": "mac64" });
}
</script>
@ -461,25 +461,19 @@
<p class="c2">
<span class="c5 c1">3.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">Associated Online Services.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Some features of the software may provide access
to, or rely on, Azure online services, including an associated Azure online service to the software
currently in development (the &ldquo;corresponding service&rdquo;). The use of those services
(but not the software) is governed by the separate terms and privacy policies in the agreement
under which you obtained the Azure services at</span>
<span class="c1">
<a class="c9" href="https://www.google.com/url?q=https://go.microsoft.com/fwLink/p/?LinkID%3D233178&amp;sa=D&amp;ust=1529596153826000">&nbsp;</a>
<span class="c5 c1">ASSOCIATED ONLINE SERVICES.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Some features of the software provide access
to, or rely on, online services to provide you information about updates to the software or extensions,
or to enable you to retrieve content, collaborate with others, or otherwise supplement your development
experience. As used throughout these license terms, the term <q>software</q> includes these online
services and features. By using these online services and features you consent to the to the
transmission of information as described in Section 5, DATA.
</span>
<span class="c1 c18">
<a class="c9" href="https://www.google.com/url?q=https://go.microsoft.com/fwLink/p/?LinkID%3D233178&amp;sa=D&amp;ust=1529596153826000">https://go.microsoft.com/fwLink/p/?LinkID=233178</a>
</span>
<span class="c3 c1">&nbsp;(and, with respect to the corresponding service, the additional terms below). Please read them.
The services may not be available in all regions.</span>
</p>
<p class="c2">
<span class="c5 c1">4.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">Licenses for other components.</span>
<span class="c5 c1">LICENSES FOR OTHER COMPONENTS.</span>
<span class="c3 c1">&nbsp;The software may include third party components with separate legal notices or governed by
other agreements, as described in the ThirdPartyNotices file accompanying the software. Even
if such components are governed by other agreements, the disclaimers and the limitations on and
@ -500,7 +494,7 @@
In using the software, you must comply with applicable law. You can learn more about data collection
and use in the help documentation and the privacy statement at </span>
<span class="c14 c1">
<a class="c9" href="https://www.google.com/url?q=http://go.microsoft.com/fwlink/?LinkId%3D398505&amp;sa=D&amp;ust=1529596153827000">http://go.microsoft.com/fwlink/?LinkId=398505</a>
<a class="c9" href="http://go.microsoft.com/fwlink/?LinkId=398505">http://go.microsoft.com/fwlink/?LinkId=398505</a>
</span>
<span class="c1">.</span>
<span class="c3 c1">&nbsp;Your use of the software operates as your consent to these practices.</span>
@ -513,7 +507,7 @@
Microsoft makes the commitments in the European Union General Data Protection Regulation Terms
of the Online Services Terms to all customers effective May 25, 2018, at </span>
<span class="c1 c14">
<a class="c9" href="https://www.google.com/url?q=http://go.microsoft.com/?linkid%3D9840733&amp;sa=D&amp;ust=1529596153828000">http://go.microsoft.com/?linkid=9840733</a>
<a class="c9" href="http://go.microsoft.com/?linkid=9840733">http://go.microsoft.com/?linkid=9840733</a>
</span>
<span class="c3 c1">.</span>
</p>
@ -794,4 +788,4 @@
</body>
</html>
</html>

11
docs/offline.md Normal file
View File

@ -0,0 +1,11 @@
# @extends
## Offline app #target-app
The MakeCode editor is available as app which you can install on a computer with Windows or Mac OS. Once installed, the **[MakeCode Offline App](/offline-app)** lets you create, run, and download your projects to the @boardname@. It works the same as the Web application does in your browser but it's a stand-alone application that will work when a connection to the internet is restricted or not available.
### ~ hint
The [MakeCode Offline App](/offline-app) is currently in development and is made available as a **pre-release** version.
### ~

BIN
docs/static/about/explorer-button.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
docs/static/about/explorer-view.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
docs/static/fll/code-js.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

BIN
docs/static/fll/context-help.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
docs/static/fll/fll-logo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
docs/static/fll/import-button.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
docs/static/fll/save-project.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
docs/static/fll/share-button.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
docs/static/fll/share-program.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
docs/static/fll/share-program.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
docs/static/fll/simulator.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

1
docs/static/githubfilelogo.svg vendored Normal file
View File

@ -0,0 +1 @@
<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path d="M16.097 2.686c-7.64 0-13.834 6.194-13.834 13.835 0 6.113 3.964 11.298 9.462 13.128.692.127.944-.301.944-.667 0-.328-.012-1.199-.019-2.353-3.848.836-4.66-1.855-4.66-1.855-.629-1.598-1.536-2.023-1.536-2.023-1.256-.859.095-.842.095-.842 1.388.099 2.119 1.426 2.119 1.426 1.234 2.114 3.238 1.504 4.027 1.15.125-.894.482-1.504.878-1.85-3.072-.349-6.302-1.536-6.302-6.838 0-1.51.539-2.745 1.424-3.712-.143-.35-.617-1.756.135-3.661 0 0 1.162-.372 3.805 1.418a13.228 13.228 0 0 1 3.464-.465c1.174.005 2.358.158 3.463.465 2.642-1.79 3.801-1.418 3.801-1.418.755 1.905.28 3.311.137 3.661.887.967 1.423 2.202 1.423 3.712 0 5.316-3.235 6.485-6.317 6.827.497.428.939 1.272.939 2.563 0 1.849-.017 3.341-.017 3.795 0 .37.249.8.951.665 5.494-1.833 9.454-7.015 9.454-13.126 0-7.641-6.195-13.835-13.836-13.835" fill="#696969"/></svg>

After

Width:  |  Height:  |  Size: 973 B

View File

@ -31,7 +31,7 @@ Open the ``||brick:Brick||`` Toolbox drawer. From the **Buttons** section, drag
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
})
brick.showString("Press my buttons!" 1)
brick.showString("Press my buttons!", 1)
```
## Step 4

View File

@ -106,9 +106,9 @@ brick.buttonRight.onEvent(ButtonEvent.Pressed, function () {
For the ``||motors:run||`` blocks that are in the ``||brick:on button left||`` and ``||brick:on button right||`` blocks, use the drop-down menu to select a ``medium motor`` on Port ``D``.
| | | |
|-|-|-|
| ![Select a motor type dropdown](/static/tutorials/run-motors/run-motor-dropdown.png) | | | ![Select a motor port dropdown](/static/tutorials/run-motors/motor-port-dropdown.png) |
![Select a motor type dropdown](/static/tutorials/run-motors/run-motor-dropdown.png)
<br/>
![Select a motor port dropdown](/static/tutorials/run-motors/motor-port-dropdown.png)
```blocks
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {

33
docs/videos.md Normal file
View File

@ -0,0 +1,33 @@
# Videos
## Tutorials
```codecard
[
{
"name": "",
"url": "https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=5d009e5f93fbf479c2e5ed2bf87a7990&source=embed&photo%5fid=35719444",
"imageUrl": "https://legoeducation.videomarketingplatform.co/27288170/35719444/5d009e5f93fbf479c2e5ed2bf87a7990/thumbnail.png"
},
{
"name": "",
"url": "https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=2008a566f1fb034d58d5ebe19ba8621f&source=embed&photo%5fid=35719467",
"imageUrl": "https://legoeducation.videomarketingplatform.co/27288175/35719467/2008a566f1fb034d58d5ebe19ba8621f/thumbnail.png"
},
{
"name": "",
"url": "https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=629730c938e452f0fd7653fbc4708166&source=embed&photo%5fid=35719470",
"imageUrl": "https://legoeducation.videomarketingplatform.co/27288172/35719470/629730c938e452f0fd7653fbc4708166/thumbnail.png"
},
{
"name": "",
"url": "https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=3513a83b87fe536b2dc512237465fd1b&source=embed&photo%5fid=35719471",
"imageUrl": "https://legoeducation.videomarketingplatform.co/27288172/35719471/3513a83b87fe536b2dc512237465fd1b/thumbnail.png"
},
{
"name": "",
"url": "https://legoeducation.videomarketingplatform.co/v.ihtml/player.html?token=5c594c2373367f7870196f519f3bfc7a&source=embed&photo%5fid=35719472",
"imageUrl": "https://legoeducation.videomarketingplatform.co/27288175/35719472/5c594c2373367f7870196f519f3bfc7a/thumbnail.png"
}
]
```

View File

@ -30,7 +30,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
<div class="ui header">${lf("First time here?")}</div>
<strong style="font-size:small">${lf("You must have version 1.10E or above of the firmware")}</strong>
<div style="justify-content: center;display: flex;padding: 1rem;">
<img class="ui image" src="./static/download/firmware.png" style="height:100px;" />
<img class="ui image" src="/static/download/firmware.png" style="height:100px;" />
</div>
<a href="/troubleshoot" target="_blank">${lf("Check your firmware version here and update if needed")}</a>
</div>
@ -42,7 +42,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
<div class="column">
<div class="ui">
<div class="image">
<img class="ui medium rounded image" src="./static/download/connect.svg" style="height:109px;width:261px;margin-bottom:1rem;" />
<img class="ui medium rounded image" src="/static/download/connect.svg" style="height:109px;width:261px;margin-bottom:1rem;" />
</div>
<div class="content">
<div class="description">
@ -57,7 +57,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
<div class="column">
<div class="ui">
<div class="image">
<img class="ui medium rounded image" src="./static/download/transfer.svg" style="height:109px;width:261px;margin-bottom:1rem;" />
<img class="ui medium rounded image" src="/static/download/transfer.svg" style="height:109px;width:261px;margin-bottom:1rem;" />
</div>
<div class="content">
<div class="description">

View File

@ -133,14 +133,27 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
this.setText(text);
}
getFirstValue(text: string) {
// Get first set of words up until last space
return this.normalizeText_(text.substring(0, text.lastIndexOf(' ')));
getFirstValue(value: string) {
const typeValue = value.indexOf('large') != -1 ? 'large' : 'medium';
const portValue = this.getSecondValue(value);
const isDual = portValue.length > 1;
return `${typeValue} motor${isDual ? 's' : ''}`;
}
getSecondValue(text: string) {
// Get last word
return this.normalizeText_(text.match(/\S*$/)[0]);
getSecondValue(value: string) {
return (value.indexOf('large') != -1) ?
value.substring(value.indexOf('large') + 5) :
value.substring(value.indexOf('medium') + 6);
}
getFirstValueI11n(value: string) {
const firstValue = this.getFirstValue(value);
const motorOptions = {
'medium motor': lf('medium motor'),
'large motor': lf('large motor'),
'large motors': lf('large motors')
}
return motorOptions[firstValue];
}
private normalizeText_(text: string) {
@ -198,8 +211,8 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
if (text === null) {
return text;
}
if (text.indexOf(' ') == -1) {
text = `large motors ${text}`;
if (text.indexOf('|') == -1) {
text = this.sourceBlock_.RTL ? `${text}|${lf("large motors")}` : `${lf("large motors")}|${text}`;
}
return text;
}
@ -296,16 +309,14 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
goog.dom.removeChildren(/** @type {!Element} */(this.textElement_));
goog.dom.removeChildren(/** @type {!Element} */(this.textElement2_));
var text = this.text_;
text = this.patchDualMotorText(text);
// First dropdown
const textNode1 = document.createTextNode(this.getFirstValue(text));
// Use one of the following options, medium motor, large motor or large motors (translated)
const textNode1 = document.createTextNode(this.getFirstValueI11n(this.value_));
this.textElement_.appendChild(textNode1);
// Second dropdown
// Second dropdown, no need to translate. Only port numbers
if (this.textElement2_) {
const textNode2 = document.createTextNode(this.getSecondValue(text));
const textNode2 = document.createTextNode(this.getSecondValue(this.value_));
this.textElement2_.appendChild(textNode2);
}
this.updateWidth();
@ -402,29 +413,28 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
contentDiv.setAttribute('aria-haspopup', 'true');
let options = this.getOptions();
// Hashmap of options
let opts = {};
let conts = {};
let vals = {};
// Go through all option values and split them into groups
for (let opt = 0; opt < options.length; opt++) {
let text = options[opt][0].alt ? options[opt][0].alt : options[opt][0];
if (text.indexOf(' ') == -1) {
// Patch dual motors as they don't have prefixes.
text = this.patchDualMotorText(text);
if (options[opt][0].alt) options[opt][0].alt = text;
}
const value = options[opt][1];
const firstValue = this.getFirstValue(text);
const secondValue = this.getSecondValue(text);
if (!opts[firstValue]) opts[firstValue] = [secondValue];
else opts[firstValue].push(secondValue);
// Store a hash of the original key value pairs for later
const motorValue = value.substring(value.indexOf('.') + 1);
const typeValue = motorValue.indexOf('large') == 0 ? 'large' : 'medium';
const portValue = motorValue.indexOf('large') == 0 ? motorValue.substring(5) : motorValue.substring(6);
const isDual = portValue.length > 1;
const text = `${typeValue} motor${isDual ? 's' : ''}|${portValue}`;
const key = `${typeValue} motor${isDual ? 's' : ''}`;
if (!opts[key]) opts[key] = [];
opts[key].push(portValue);
conts[text] = options[opt][0];
vals[text] = value;
}
const currentFirst = this.getFirstValue(this.text_);
const currentSecond = this.getSecondValue(this.text_);
const currentFirst = this.getFirstValue(this.value_);
const currentSecond = this.getSecondValue(this.value_);
if (!this.isFirst_) {
options = opts[currentFirst];
@ -432,9 +442,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
options = Object.keys(opts);
// Flip the first and second options to make it sorted the way we want it (medium, large, dual)
if (options.length == 3) {
const temp = options[1];
options[1] = options[0];
options[0] = temp;
options = [lf("medium motor"), lf("large motor"), lf("large motors")];
} else {
options.reverse();
}
@ -448,7 +456,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
const columns = options.length;
for (let i = 0, option: any; option = options[i]; i++) {
let text = this.isFirst_ ? option + ' ' + opts[option][0] : currentFirst + ' ' + option;
let text = this.isFirst_ ? option + '|' + (option.indexOf('motors') != -1 ? 'BC' : 'A') : currentFirst + '|' + option;
text = text.replace(/\xA0/g, ' ');
const content: any = conts[text];
const value = vals[text];
@ -466,7 +474,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
button.setAttribute('id', ':' + i); // For aria-activedescendant
button.setAttribute('role', 'menuitem');
button.setAttribute('class', 'blocklyDropDownButton');
button.title = this.isFirst_ ? this.getFirstValue(content.alt) : content.alt;
button.title = this.isFirst_ ? this.getFirstValueI11n(value) : this.getSecondValue(value);
button.style.width = ((this.itemWidth_) - 8) + 'px';
button.style.height = ((this.itemWidth_) - 8) + 'px';
let backgroundColor = this.backgroundColour_;
@ -495,7 +503,15 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
contentDiv.removeAttribute('aria-activedescendant');
});
let buttonImg = document.createElement('img');
buttonImg.src = this.isFirst_ ? isFirstUrl[option.replace(/\xA0/g, ' ')] : content.src;
let imgSrc = content.src;
if (this.isFirst_) {
const motorValue = value.substring(value.indexOf('.') + 1);
// Find out what kind of motor this is based on it's value, possible values: mediumX, largeX, and largeXY
if (motorValue.indexOf('medium') == 0) imgSrc = isFirstUrl['medium motor'];
else if (motorValue.length == 6) imgSrc = isFirstUrl['large motor'];
else imgSrc = isFirstUrl['large motors'];
}
buttonImg.src = imgSrc;
//buttonImg.alt = icon.alt;
// Upon click/touch, we will be able to get the clicked element as e.target
// Store a data attribute on all possible click targets so we can match it to the icon.

View File

@ -1,41 +0,0 @@
import jobs.generation.Utilities;
import jobs.generation.InternalUtilities;
def project = GithubProject
def projectName = "pxt-ev3"
[true, false].each { isPR ->
def newJobName = projectName
if (isPR) {
newJobName += "_PR"
} else {
newJobName += "_Push"
}
def newJob = job(newJobName) {
steps {
shell("chmod +x ./jenkins.sh")
shell("./jenkins.sh ${isPR}")
}
if (!isPR) {
wrappers {
credentialsBinding {
string("PXT_ACCESS_TOKEN", "pxt_access_token")
string("PXT_RELEASE_REPO", "pxt_release_repo_ev3")
string("CROWDIN_KEY", "pxt_crowdin_key")
}
}
}
}
Utilities.setMachineAffinity(newJob, "Ubuntu", "20161020")
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
if (isPR) {
Utilities.addGithubPRTrigger(newJob, "Default Testing")
} else {
Utilities.addGithubPushTrigger(newJob)
}
}

View File

@ -1,56 +0,0 @@
#!/usr/bin/env bash
# Set up NVM
export NVM_DIR="/home/dotnet-bot/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install 8
# Set up build environment variables
echo ---------- Setting build environment variables
echo Git branch: $GIT_BRANCH
echo isPR: $1
originRegex="^origin/.*"
branchRegex="^origin/\K.*(?=$)"
releaseBranchRegex="^(master|v\d+)$"
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
echo Setting TRAVIS_BRANCH to ${branchName}
export TRAVIS_BRANCH=${branchName}
else
echo Setting TRAVIS_BRANCH to $GIT_BRANCH
export TRAVIS_BRANCH=$GIT_BRANCH
fi
if [ "$1" == "false" ]; then
echo Setting TRAVIS_PULL_REQUEST to false
export TRAVIS_PULL_REQUEST=false
if [[ "$TRAVIS_BRANCH" =~ $releaseBranchRegex ]]; then
if [[ -z $PXT_RELEASE_REPO ]]; then
echo Cannot find release repo\; skipping tag checks
else
gitTag=$(git describe --tags --exact-match 2> /dev/null)
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
echo Current tag: $gitTag
echo Built tag: $builtTag
if [[ ! -z $gitTag && -z $builtTag ]]; then
echo Built tag not found\; building tag
echo Setting TRAVIS_BRANCH to $gitTag
export TRAVIS_BRANCH=$gitTag
echo Setting TRAVIS_TAG to $gitTag
export TRAVIS_TAG=$gitTag
else
echo Not a tag build
fi
fi
fi
fi
# Perform build
npm install
npm test

View File

@ -1,5 +1,5 @@
const enum ColorSensorMode {
None = -1,
None = 0,
//% block="reflected light intensity"
ReflectedLightIntensity = 0,
//% block="ambient light intensity"
@ -15,7 +15,9 @@ enum LightIntensityMode {
//% block="reflected light"
Reflected = ColorSensorMode.ReflectedLightIntensity,
//% block="ambient light"
Ambient = ColorSensorMode.AmbientLightIntensity
Ambient = ColorSensorMode.AmbientLightIntensity,
//% block="reflected light (raw)"
ReflectedRaw = ColorSensorMode.RefRaw
}
const enum ColorSensorColor {
@ -93,6 +95,8 @@ namespace sensors {
|| this.mode == ColorSensorMode.AmbientLightIntensity
|| this.mode == ColorSensorMode.ReflectedLightIntensity)
return this.getNumber(NumberFormat.UInt8LE, 0)
if (this.mode == ColorSensorMode.RefRaw || this.mode == ColorSensorMode.RgbRaw)
return this.getNumber(NumberFormat.UInt16LE, 0)
return 0
}
@ -114,7 +118,7 @@ namespace sensors {
_update(prev: number, curr: number) {
if (this.calibrating) return; // simply ignore data updates while calibrating
if (this.mode == ColorSensorMode.Color)
if (this.mode == ColorSensorMode.Color || this.mode == ColorSensorMode.RgbRaw || this.mode == ColorSensorMode.RefRaw)
control.raiseEvent(this._id, this._colorEventValue(curr));
else
this.thresholdDetector.setLevel(curr);
@ -179,6 +183,22 @@ namespace sensors {
return this.getNumber(NumberFormat.UInt8LE, 0)
}
/**
* Get the current raw rgb values from the color sensor.
* @param sensor the color sensor to query the request
*/
//% help=sensors/color-sensor/rgbraw
//% parts="colorsensor"
//% blockNamespace=sensors
//% this.fieldEditor="ports"
//% weight=98
//% group="Color Sensor"
//% blockGap=8
rgbRaw(): number[] {
this.setMode(ColorSensorMode.RgbRaw);
return [this.getNumber(NumberFormat.UInt16LE, 0), this.getNumber(NumberFormat.UInt16LE, 2), this.getNumber(NumberFormat.UInt16LE, 4)];
}
/**
* Registers code to run when the ambient light changes.
* @param condition the light condition
@ -229,7 +249,12 @@ namespace sensors {
//% group="Color Sensor"
light(mode: LightIntensityMode) {
this.setMode(<ColorSensorMode><number>mode)
return this.getNumber(NumberFormat.UInt8LE, 0)
switch(mode) {
case LightIntensityMode.ReflectedRaw:
return this.reflectedLightRaw();
default:
return this.getNumber(NumberFormat.UInt8LE, 0)
}
}
/**
@ -248,6 +273,15 @@ namespace sensors {
return this.light(LightIntensityMode.Reflected);
}
/**
* Gets the raw reflection light value
*/
//%
reflectedLightRaw(): number {
this.setMode(ColorSensorMode.RefRaw);
return this.getNumber(NumberFormat.UInt16LE, 0);
}
/**
* Set a threshold value
* @param condition the dark or bright light condition
@ -297,9 +331,22 @@ namespace sensors {
calibrateLight(mode: LightIntensityMode, deviation: number = 8) {
this.calibrating = true; // prevent events
this.light(mode); // trigger a read
pauseUntil(() => this.isActive()); // ensure sensor is live
const statusLight = brick.statusLight(); // save current status light
brick.setStatusLight(StatusLight.Orange);
this.light(mode); // trigger a read
pauseUntil(() => this.isActive(), 5000); // ensure sensor is live
// check sensor is ready
if (!this.isActive()) {
brick.setStatusLight(StatusLight.RedFlash); // didn't work
pause(2000);
brick.setStatusLight(statusLight); // restore previous light
return;
}
// calibrating
brick.setStatusLight(StatusLight.OrangePulse);
let vold = 0;
let vcount = 0;
@ -331,6 +378,10 @@ namespace sensors {
this.thresholdDetector.setLowThreshold(min);
this.thresholdDetector.setHighThreshold(max);
brick.setStatusLight(StatusLight.Green); // success
pause(1000);
brick.setStatusLight(statusLight); // resture previous light
this.calibrating = false;
}

View File

@ -13,6 +13,15 @@ Sometimes when external lighting conditions change, the light sensor measures li
* **mode**: the type of light threshold to calibrate. This is either ``ambient`` or ``reflected`` light.
* **deviation**: a [number](/types/number) that is the amount of light level change to adjust in a measurement.
## Calibration states
Calibration happens in the following phases and each phase is tracked by the brick status light.
* **orange**: sensor initialization. This phase ensures that the sensor is in the desired mode and ready to collect data.
* **orange pulse**: data collection. Light information is being collected, move the sensor over the various light sources to detect.
* **green**: calibration success. The calibration data has been saved.
* **red flash**: sensor failure. We were unable to connect to the sensor.
## Example
Calibrate the ``dark`` and ``light`` thresholds for the ``color 2`` sensor using reflected light.
@ -23,4 +32,4 @@ sensors.color2.calibrateLight(LightIntensityMode.Reflected)
## See also
[set threshold](/reference/sensors/color-sensor/set-threshold)
[set threshold](/reference/sensors/color-sensor/set-threshold)

View File

@ -162,7 +162,6 @@ 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.stopAll(); // ensuring that all motors are off
control.reset()
}
return ret
@ -247,6 +246,15 @@ namespace brick {
// the brick starts with the red color
let currPattern: StatusLight = StatusLight.Off;
/**
* Gets the current light pattern.
*/
//% weight=99 group="Buttons"
//% help=brick/status-light
export function statusLight() {
return currPattern;
}
/**
* Set lights.
* @param pattern the lights pattern to use. eg: StatusLight.Orange

View File

@ -25,8 +25,17 @@ namespace sensors.internal {
})
}
export function bufferToString(buf: Buffer): string {
let s = ''
for (let i = 0; i < buf.length; i++)
s += String.fromCharCode(buf[i])
return s
}
let analogMM: MMap
let uartMM: MMap
let IICMM: MMap
let devcon: Buffer
let sensorInfos: SensorInfo[]
@ -36,11 +45,13 @@ namespace sensors.internal {
sensors: Sensor[]
connType: number
devType: number
iicid: string
constructor(p: number) {
this.port = p
this.connType = DAL.CONN_NONE
this.devType = DAL.DEVICE_TYPE_NONE
this.iicid = ''
this.sensors = []
}
}
@ -57,6 +68,9 @@ namespace sensors.internal {
uartMM = control.mmap("/dev/lms_uart", UartOff.Size, 0)
if (!uartMM) control.fail("no uart sensor")
IICMM = control.mmap("/dev/lms_iic", IICOff.Size, 0)
if(!IICMM) control.fail("no iic sensor")
forever(() => {
detectDevices()
pause(500)
@ -89,6 +103,15 @@ namespace sensors.internal {
//serial.writeLine("UART " + port + " / " + mode + " - " + info)
}
export function readIICID(port: number) {
let buf = output.createBuffer(IICStr.Size)
buf[IICStr.Port] = port
IICMM.ioctl(IO.IIC_READ_TYPE_INFO, buf)
let Manufacturer = bufferToString(buf.slice(IICStr.Manufacturer, 8))
let SensorType = bufferToString(buf.slice(IICStr.SensorType, 8))
return Manufacturer + SensorType ;
}
export function getBatteryInfo(): { temp: number; current: number } {
init();
return {
@ -97,6 +120,7 @@ namespace sensors.internal {
}
}
let nonActivated = 0;
function detectDevices() {
let conns = analogMM.slice(AnalogOff.InConn, DAL.NUM_INPUTS)
let numChanged = 0
@ -114,6 +138,11 @@ namespace sensors.internal {
let uinfo = readUartInfo(info.port, 0)
info.devType = uinfo[TypesOff.Type]
control.dmesg(`UART type ${info.devType}`)
} else if(newConn == DAL.CONN_NXT_IIC){
control.dmesg(`new IIC connection at ${info.port}`)
info.devType = DAL.DEVICE_TYPE_IIC_UNKNOWN
info.iicid = readIICID(info.port)
control.dmesg(`IIC ID ${info.iicid.length}`)
} else if (newConn == DAL.CONN_INPUT_DUMB) {
control.dmesg(`new DUMB connection at ${info.port}`)
// TODO? for now assume touch
@ -125,19 +154,26 @@ namespace sensors.internal {
}
}
if (numChanged == 0)
if (numChanged == 0 && nonActivated == 0)
return
nonActivated = 0;
for (let si of sensorInfos) {
if (si.sensor && si.sensor._deviceType() != si.devType) {
si.sensor = null
}
if (si.devType != DAL.DEVICE_TYPE_NONE) {
// TODO figure out compiler problem when '|| null' is added here!
if(si.devType == DAL.DEVICE_TYPE_IIC_UNKNOWN){
si.sensor = si.sensors.filter(s => s._IICId() == si.iicid)[0]
if (!si.sensor) {
control.dmesg(`sensor not found for iicid=${si.iicid} at ${si.port}`)
nonActivated++;
}else{
control.dmesg(`sensor connected iicid=${si.iicid} at ${si.port}`)
si.sensor._activated()
}
}else if (si.devType != DAL.DEVICE_TYPE_NONE) {
si.sensor = si.sensors.filter(s => s._deviceType() == si.devType)[0]
if (si.sensor == null) {
if (!si.sensor) {
control.dmesg(`sensor not found for type=${si.devType} at ${si.port}`)
} else {
nonActivated++;
}else{
control.dmesg(`sensor connected type=${si.devType} at ${si.port}`)
si.sensor._activated()
}
@ -187,6 +223,10 @@ namespace sensors.internal {
_deviceType() {
return 0
}
_IICId() {
return ''
}
}
export class AnalogSensor extends Sensor {
@ -207,12 +247,11 @@ namespace sensors.internal {
constructor(port: number) {
super(port)
this.mode = 0
this.realmode = -1
this.realmode = 0
}
_activated() {
this.realmode = 0
// uartReset(this.port) // TODO is it ever needed?
this._setMode(this.mode)
}
@ -243,6 +282,55 @@ namespace sensors.internal {
}
}
export class IICSensor extends Sensor {
protected mode: number // the mode user asked for
protected realmode: number // the mode the hardware is in
private readLength: number
constructor(port: number) {
super(port)
this.mode = 0
this.realmode = 0
this.readLength = 1;
}
_activated() {
this.realmode = 0
this._setMode(this.mode)
}
protected _setMode(m: number) {
let v = m | 0
this.mode = v
if (!this.isActive()) return
if (this.realmode != this.mode) {
this.realmode = v
setIICMode(this._port, this._deviceType() ,v)
}
}
getBytes(): Buffer {
return getIICBytes(this.isActive() ? this._port : -1, this.readLength)
}
getNumber(fmt: NumberFormat, off: number) {
if (!this.isActive())
return 0
return getIICNumber(this.readLength, fmt, off, this._port)
}
transaction(deviceAddress: number, write: number[], read: number){
this.readLength = read;
transactionIIC(this._port, deviceAddress, write, read)
}
_deviceType (){
return DAL.DEVICE_TYPE_IIC_UNKNOWN
}
}
export const iicsensor = new IICSensor(3)
function uartReset(port: number) {
if (port < 0) return
control.dmesg(`UART reset at ${port}`)
@ -322,6 +410,48 @@ namespace sensors.internal {
UartOff.Raw + DAL.MAX_DEVICE_DATALENGTH * 300 * port + DAL.MAX_DEVICE_DATALENGTH * index + off)
}
export function setIICMode(port: number, type: number, mode: number){
if(port < 0)return;
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Connection + port, DAL.CONN_NXT_IIC)
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Type + port, type)
devcon.setNumber(NumberFormat.Int8LE, DevConOff.Mode + port, mode)
IICMM.ioctl(IO.IIC_SET_CONN, devcon)
}
export function transactionIIC(port: number, deviceAddress: number, writeBuf: number[], readLen: number){
if(port < 0)return;
let iicdata = output.createBuffer(IICDat.Size)
iicdata.setNumber(NumberFormat.Int8LE, IICDat.Port, port)
iicdata.setNumber(NumberFormat.Int8LE, IICDat.Repeat, 0)
iicdata.setNumber(NumberFormat.Int16LE, IICDat.Time, 0)
iicdata.setNumber(NumberFormat.Int8LE, IICDat.WrLng, writeBuf.length + 1)
for(let i = 0; i< writeBuf.length; i++)
iicdata.setNumber(NumberFormat.Int8LE, IICDat.WrData + i + 1, writeBuf[i])
iicdata.setNumber(NumberFormat.Int8LE, IICDat.WrData, deviceAddress)
iicdata.setNumber(NumberFormat.Int8LE, IICDat.RdLng, readLen)
IICMM.ioctl(IO.IIC_SETUP, iicdata)
}
export function getIICBytes(port: number, length: number) {
if (port < 0) return output.createBuffer(length);
let index = IICMM.getNumber(NumberFormat.UInt16LE, IICOff.Actual + port * 2);
let buf = IICMM.slice(
IICOff.Raw + DAL.MAX_DEVICE_DATALENGTH * 300 * port + DAL.MAX_DEVICE_DATALENGTH * index,
length
);
// Reverse
for (let i = 0; i < length / 2; i++) {
let c = buf[i]
buf[i] = buf[length - i - 1]
buf[length - i - 1] = c
}
return buf;
}
export function getIICNumber(length: number, format: NumberFormat, off: number, port: number) {
return getIICBytes(port, length).getNumber(format, off)
}
const enum NxtColOff {
Calibration = 0, // uint32[4][3]
@ -405,6 +535,52 @@ namespace sensors.internal {
Size = 58
}
const enum IICOff {
TypeData = 0, // Types[8][4]
Repeat = 1792, // uint16[300][4]
Raw = 4192, // int8[32][300][4]
Actual = 42592, // uint16[4]
LogIn = 42600, // uint16[4]
Status = 42608, // int8[4]
Output = 42612, // int8[32][4]
OutputLength = 42740, // int8[4]
Size = 42744
}
const enum IICCtlOff {
TypeData = 0, // Types
Port = 56, // int8
Mode = 57, // int8
Size = 58
}
const enum IICDat {
Result = 0, // result
Port = 4, // int8
Repeat = 5, // int8
Time = 6, // int16
WrLng = 8, // int8
WrData = 9, // int8[32]
RdLng = 41, // int8
RdData = 42, //int8[32]
Size = 74,
}
const enum IICStr {
Port = 0, // int8
Time = 2, // int16
Type = 4, // int8
Mode = 5, // int8
Manufacturer = 6, // int8[9]
SensorType = 15, // int[9]
SetupLng = 24, // int8
SetupString = 28, // ulong
PollLng = 32, // int8
PollString = 36, // ulong
ReadLng = 40, // int8
Size = 44
}
const enum IO {
UART_SET_CONN = 0xc00c7500,
UART_READ_MODE_INFO = 0xc03c7501,
@ -513,4 +689,4 @@ namespace sensors {
}
}
}
}
}

View File

@ -14,6 +14,7 @@
#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
#include "ev3const.h"
#define THREAD_DBG(...)
@ -489,14 +490,22 @@ void runLMS() {
}
void stopMotors() {
uint8_t cmd[2] = { 0xA3, 0x0F };
uint8_t cmd[3] = { opOutputStop, 0x0F, 0 };
int fd = open("/dev/lms_pwm", O_RDWR);
write(fd, cmd, 2);
write(fd, cmd, 3);
close(fd);
}
void stopProgram() {
uint8_t cmd[1] = { opOutputProgramStop };
int fd = open("/dev/lms_pwm", O_RDWR);
write(fd, cmd, 1);
close(fd);
}
extern "C" void target_reset() {
stopMotors();
stopProgram();
if (lmsPid)
runLMS();
else

View File

@ -134,10 +134,13 @@ namespace motors {
protected _brake: boolean;
private _pauseOnRun: boolean;
private _initialized: boolean;
private _brakeSettleTime: number;
private _init: () => void;
private _run: (speed: number) => void;
private _move: (steps: boolean, stepsOrTime: number, speed: number) => void;
protected static output_types: number[] = [0x7, 0x7, 0x7, 0x7];
constructor(port: Output, init: () => void, run: (speed: number) => void, move: (steps: boolean, stepsOrTime: number, speed: number) => void) {
super();
this._port = port;
@ -145,6 +148,7 @@ namespace motors {
this._brake = false;
this._pauseOnRun = true;
this._initialized = false;
this._brakeSettleTime = 10;
this._init = init;
this._run = run;
this._move = move;
@ -202,6 +206,20 @@ namespace motors {
writePWM(b)
}
/**
* Set the settle time after braking in milliseconds (default is 10ms).
*/
//% blockId=motorSetBrakeSettleTime block="set %motor|brake settle time %millis|ms"
//% motor.fieldEditor="motors"
//% weight=1 blockGap=8
//% group="Properties"
//% millis.defl=200 millis.min=0 millis.max=500
setBrakeSettleTime(millis: number) {
this.init();
// ensure in [0,500]
this._brakeSettleTime = Math.max(0, Math.min(500, millis | 0))
}
/**
* Stops the motor(s).
*/
@ -219,8 +237,8 @@ namespace motors {
protected settle() {
// if we've recently completed a motor command with brake
// allow 500ms for robot to settle
if (this._brake)
pause(500);
if (this._brake && this._brakeSettleTime > 0)
pause(this._brakeSettleTime);
}
protected pauseOnRun(stepsOrTime: number) {
@ -321,20 +339,25 @@ namespace motors {
}
protected setOutputType(large: boolean) {
/*
Instruction opOutput_Set_Type (LAYER, NO, TYPE)
Opcode 0xA1 Arguments (Data8) LAYER Specify chain layer number [0 - 3]
(Data8) NO Port number [0 - 3]
(Data8) TYPE Output device type, (0x07: Large motor, Medium motor = 0x08) Dispatch status Unchanged
Description This function enables specifying the output device type
*/
for (let i = 0; i < DAL.NUM_OUTPUTS; ++i) {
for (let i = 0; i < DAL.NUM_OUTPUTS; ++i) {
if (this._port & (1 << i)) {
const b = mkCmd(i, DAL.opOutputSetType, 1)
b.setNumber(NumberFormat.Int8LE, 2, large ? 0x07 : 0x08)
writePWM(b)
// (0x07: Large motor, Medium motor = 0x08)
MotorBase.output_types[i] = large ? 0x07 : 0x08;
}
}
MotorBase.setTypes();
}
// Note, we are having to create our own buffer here as mkCmd creates a buffer with a command
// In the case of opOutputSetType, it expects the arguments to be opOutputSetType [type0, type1, type2, type3]
static setTypes() {
const b = output.createBuffer(5)
b.setNumber(NumberFormat.UInt8LE, 0, DAL.opOutputSetType)
b.setNumber(NumberFormat.Int8LE, 1, MotorBase.output_types[0]);
b.setNumber(NumberFormat.Int8LE, 2, MotorBase.output_types[1]);
b.setNumber(NumberFormat.Int8LE, 3, MotorBase.output_types[2]);
b.setNumber(NumberFormat.Int8LE, 4, MotorBase.output_types[3]);
writePWM(b)
}
}
@ -368,7 +391,8 @@ namespace motors {
}
private __move(steps: boolean, stepsOrTime: number, speed: number) {
step(this._port, {
control.dmesg("motor.__move")
const p = {
useSteps: steps,
step1: 0,
step2: stepsOrTime,
@ -376,7 +400,10 @@ namespace motors {
speed: this._regulated ? speed : undefined,
power: this._regulated ? undefined : speed,
useBrake: this._brake
})
};
control.dmesg("motor.1")
step(this._port, p)
control.dmesg("motor.__move end")
}
/**
@ -385,7 +412,7 @@ namespace motors {
*/
//% blockId=outputMotorSetRegulated block="set %motor|regulated %value=toggleOnOff"
//% motor.fieldEditor="motors"
//% weight=58
//% weight=58 blockGap=8
//% group="Properties"
//% help=motors/motor/set-regulated
setRegulated(value: boolean) {
@ -706,36 +733,36 @@ namespace motors {
}
function step(out: Output, opts: StepOptions) {
control.dmesg('step')
let op = opts.useSteps ? DAL.opOutputStepSpeed : DAL.opOutputTimeSpeed
let speed = opts.speed
if (speed == null) {
if (undefined == speed) {
speed = opts.power
op = opts.useSteps ? DAL.opOutputStepPower : DAL.opOutputTimePower
if (speed == null)
if (undefined == speed)
return
}
speed = Math.clamp(-100, 100, speed)
control.dmesg('speed: ' + speed)
let b = mkCmd(out, op, 15)
control.dmesg('STEP 5')
b.setNumber(NumberFormat.Int8LE, 2, speed)
// note that b[3] is padding
control.dmesg('STEP 1')
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 0, opts.step1)
control.dmesg('STEP 2')
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 1, opts.step2)
control.dmesg('STEP 3')
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 2, opts.step3)
b.setNumber(NumberFormat.Int8LE, 4 + 4 * 3, opts.useBrake ? 1 : 0)
writePWM(b)
}
const types = [0, 0, 0, 0]
export function setType(out: Output, type: OutputType) {
let b = mkCmd(out, DAL.opOutputSetType, 3)
for (let i = 0; i < 4; ++i) {
if (out & (1 << i)) {
types[i] = type
}
b.setNumber(NumberFormat.UInt8LE, i + 1, types[i])
}
control.dmesg('STEP 4')
control.dmesg('br ' + opts.useBrake);
const br = !!opts.useBrake ? 1 : 0;
control.dmesg('Step 4.5 ' + br)
b.setNumber(NumberFormat.Int8LE, 4 + 4 * 3, br)
control.dmesg('STEP 5')
writePWM(b)
control.dmesg('end step')
}
}

View File

@ -22,6 +22,15 @@ To properly reset the gyro, the brick must remain still (undistrurbed) while the
## ~
## Calibration states
Calibration happens in the following phases and each phase is tracked by the brick status light.
* **orange**: sensor initialization. This phase ensures that the sensor is in the desired mode and ready to collect data.
* **orange pulse**: data collection. Light information is being collected, move the sensor over the various light sources to detect.
* **green**: calibration success. The calibration data has been saved.
* **red flash**: sensor failure. We were unable to connect to the sensor.
## Example
Set the brick on a flat surface. Reset `gyro 2` and tilt the brick slighly. Reset it again while it's still tilted. Lay the brick down flat again and display the angle measurement.
@ -36,4 +45,4 @@ brick.buttonRight.onEvent(ButtonEvent.Pressed, function () {
## See also
[angle](/reference/sensors/gyro/angle), [rate](/reference/sensors/gyro/rate)
[angle](/reference/sensors/gyro/angle), [rate](/reference/sensors/gyro/rate)

View File

@ -1,5 +1,5 @@
const enum GyroSensorMode {
None = -1,
None = 0,
Angle = 0,
Rate = 1,
}
@ -92,6 +92,9 @@ namespace sensors {
reset(): void {
if (this.calibrating) return; // already in calibration mode
const statusLight = brick.statusLight(); // save current status light
brick.setStatusLight(StatusLight.Orange);
this.calibrating = true;
// may be triggered by a button click,
// give time for robot to settle
@ -101,9 +104,22 @@ namespace sensors {
// switch back to the desired mode
this.setMode(this.mode);
// wait till sensor is live
pauseUntil(() => this.isActive());
pauseUntil(() => this.isActive(), 5000);
// check sensor is ready
if (!this.isActive()) {
brick.setStatusLight(StatusLight.RedFlash); // didn't work
pause(2000);
brick.setStatusLight(statusLight); // restore previous light
return;
}
// give it a bit of time to init
pause(1000)
// calibrating
brick.setStatusLight(StatusLight.OrangePulse);
// compute drift
this._drift = 0;
if (this.mode == GyroSensorMode.Rate) {
@ -113,6 +129,11 @@ namespace sensors {
}
this._drift /= 200;
}
brick.setStatusLight(StatusLight.Green); // success
pause(1000);
brick.setStatusLight(statusLight); // resture previous light
// and we're done
this.calibrating = false;
}

View File

@ -1,5 +1,5 @@
const enum InfraredSensorMode {
None = -1,
None = 0,
Proximity = 0,
Seek = 1,
RemoteControl = 2,

View File

@ -9,5 +9,5 @@ sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
## See Also
[on event](/reference/sensors/ultrasonic/on-event),
[distance](reference/sensors/ultrasonic/distance),
[pause until](reference/sensors/ultrasonic/pause-until)
[distance](/reference/sensors/ultrasonic/distance),
[pause until](/reference/sensors/ultrasonic/pause-until)

4670
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
{
"name": "pxt-ev3",
"version": "1.0.1",
"version": "1.1.7",
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
"private": true,
"private": false,
"keywords": [
"JavaScript",
"education",
@ -39,8 +39,8 @@
"webfonts-generator": "^0.4.0"
},
"dependencies": {
"pxt-common-packages": "0.23.55",
"pxt-core": "4.0.1"
"pxt-common-packages": "0.23.61",
"pxt-core": "4.0.9"
},
"scripts": {
"test": "node node_modules/pxt-core/built/pxt.js travis"

View File

@ -79,11 +79,11 @@
},
"appTheme": {
"accentColor": "#0089BF",
"logoUrl": "https://education.lego.com/",
"logoWide": true,
"logoUrl": "https://education.lego.com/",
"logo": "./static/lego_education_logo.png",
"docsLogo": "./static/lego-logo.svg",
"portraitLogo": "./static/lego-logo.svg",
"footerLogo": "./static/lego-logo.svg",
"docsLogo": "./static/lego_education_logo.png",
"portraitLogo": "./static/lego_education_logo.png",
"cardLogo": "./static/icons/android-chrome-192x192.png",
"appLogo": "./static/icons/android-chrome-192x192.png",
"organization": "Microsoft MakeCode",
@ -108,6 +108,7 @@
"zh-CN"
],
"highContrast": true,
"lightToc": true,
"docMenu": [
{
"name": "Support",
@ -177,7 +178,8 @@
"monacoColors": {
"editor.background": "#f9f9f9"
},
"fileNameExclusiveFilter": "[^a-zA-Z0-9]"
"fileNameExclusiveFilter": "[^a-zA-Z0-9]",
"enableTrace": true
},
"ignoreDocsErrors": true
}

View File

@ -27,6 +27,7 @@ namespace pxsim.sensors {
export function __sensorUsed(port: number, type: number) {
//console.log("SENSOR INIT " + port + ", type: " + type);
if (type == DAL.DEVICE_TYPE_IIC_UNKNOWN) return; // Ignore IIC
if (!ev3board().hasSensor(port)) {
const sensor = ev3board().getSensor(port, type);
runtime.queueDisplayUpdate();

View File

@ -12,9 +12,10 @@
"Tutorials": "tutorials",
"Design Engineering": "design-engineering",
"Coding": "coding",
"Maker": "maker"
"Maker": "maker",
"Videos": "videos"
},
"electronManifest": {
"latest": "v0.4.2"
"latest": "v1.0.11"
}
}