Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
d76cea1477 | |||
ca09a0a833 | |||
fcc864823e | |||
166dc27b93 | |||
66e50473c4 | |||
58452e1ca3 | |||
2b7498ea2d | |||
5ab2b97663 | |||
ffe0f0fb32 | |||
f27d13f88e | |||
31067dcef8 | |||
123f6c84b2 | |||
c5f07ca67c | |||
22fc7dee18 | |||
1f58b649c5 | |||
fc75fe8e16 | |||
b399c37527 | |||
a054fdd3d3 | |||
a239589913 | |||
98a046237c | |||
eb385ec532 | |||
2fdce16685 | |||
74eb77a9ae | |||
4fba96588f | |||
03c07bdcf5 | |||
6da1bc3cb1 | |||
dfc9ca1db4 | |||
83b64c1e54 | |||
a0cf8655f2 | |||
e4cf2c99c0 | |||
076fb8487e | |||
c725561389 | |||
3dc781f4fd | |||
4456767f2d |
@ -5,6 +5,7 @@
|
|||||||
* [Troubleshoot](/troubleshoot)
|
* [Troubleshoot](/troubleshoot)
|
||||||
* [EV3 Manager](https://ev3manager.education.lego.com/)
|
* [EV3 Manager](https://ev3manager.education.lego.com/)
|
||||||
* [LEGO Support](https://www.lego.com/service/)
|
* [LEGO Support](https://www.lego.com/service/)
|
||||||
|
* [FIRST LEGO League](/fll)
|
||||||
|
|
||||||
## Projects #projects
|
## Projects #projects
|
||||||
|
|
||||||
@ -82,12 +83,12 @@
|
|||||||
* [reset](/reference/sensors/gyro/reset)
|
* [reset](/reference/sensors/gyro/reset)
|
||||||
* [Ultrasonic](/reference/sensors/ultrasonic)
|
* [Ultrasonic](/reference/sensors/ultrasonic)
|
||||||
* [on event](/reference/sensors/ultrasonic/on-event)
|
* [on event](/reference/sensors/ultrasonic/on-event)
|
||||||
* [distance](reference/sensors/ultrasonic/distance)
|
* [distance](/reference/sensors/ultrasonic/distance)
|
||||||
* [pause until](reference/sensors/ultrasonic/pause-until)
|
* [pause until](/reference/sensors/ultrasonic/pause-until)
|
||||||
* [Infrared](/reference/sensors/infrared)
|
* [Infrared](/reference/sensors/infrared)
|
||||||
* [on event](/reference/sensors/infrared/on-event)
|
* [on event](/reference/sensors/infrared/on-event)
|
||||||
* [distance](reference/sensors/infrared/proximity)
|
* [distance](/reference/sensors/infrared/proximity)
|
||||||
* [pause until](reference/sensors/infrared/pause-until)
|
* [pause until](/reference/sensors/infrared/pause-until)
|
||||||
* [Infrared beacon](/reference/sensors/beacon)
|
* [Infrared beacon](/reference/sensors/beacon)
|
||||||
* [on event](/reference/sensors/beacon/on-event)
|
* [on event](/reference/sensors/beacon/on-event)
|
||||||
* [pause until](/reference/sensors/beacon/pause-until)
|
* [pause until](/reference/sensors/beacon/pause-until)
|
||||||
|
@ -36,22 +36,16 @@ Think about a creature’s movement for inspiration. Your mechanism can be attac
|
|||||||
|
|
||||||
More building ideas:
|
More building ideas:
|
||||||
|
|
||||||
| | | | | |
|
|
||||||
|-|-|-|-|-|
|
|
||||||
|[][EV3 Frames] | |[][Color Sensor 1] | |[][Gyro Sensor] |
|
|
||||||
| [EV3 Frames] | | [Color Sensor 1] | | [Gyro Sensor] |
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
| | | | | |
|
* [EV3 Frames]
|
||||||
|-|-|-|-|-|
|
* [Color Sensor 1]
|
||||||
|[][Ultrasonic Sensor] | | [][Touch Sensor] | | [][Jaw] |
|
* [Gyro Sensor]
|
||||||
| [Ultrasonic Sensor] | | [Touch Sensor] | | [Jaw] |
|
* [Ultrasonic Sensor]
|
||||||
<br/>
|
* [Touch Sensor]
|
||||||
|
* [Jaw]
|
||||||
| | | | | |
|
* [Leg 1]
|
||||||
|-|-|-|-|-|
|
* [Leg 2]
|
||||||
| [][Leg 1] | | [][Leg 2] | | [][Leg 3] |
|
* [Leg 3]
|
||||||
| [Leg 1] | | [Leg 2] | | [Leg 3] |
|
|
||||||
|
|
||||||
### ~hint
|
### ~hint
|
||||||
|
|
||||||
|
106
docs/fll.md
Normal file
106
docs/fll.md
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
# MakeCode for _FIRST_ LEGO League
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
For teams participating in the Open Software Platform Pilot utilizing MakeCode, we’ve compiled a list of resources and information that we hope will be helpful for you.
|
||||||
|
|
||||||
|
## Open Issues
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
### What’s 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! – show your EV3 brick waking up
|
||||||
|
* Animation – create a custom animation to show
|
||||||
|
* Music Brick – transform your EV3 into a musical instrument
|
||||||
|
* Run Motors – control the motors of your robot
|
||||||
|
* Red Light, Green Light – play red light, green light with the color sensor
|
||||||
|
* 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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
### 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 with 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)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
```sim
|
||||||
|
sensors.touch1.onEvent(ButtonEvent.Pressed, function () {
|
||||||
|
motors.largeD.run(50)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the Simulator is also interactive, so you can simulate inputs with any of the sensors.
|
||||||
|
|
||||||
|
### 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
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
* You can import your saved projects by clicking the Import button on the Home Page
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
## 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://join.slack.com/t/fllrobotsw/shared_invite/enQtNDU1MjQ5MDU0ODQ5LTY0ZTgzMDk1MThjYjg4NmM5ZTlmMWJhMzg4OWI2ZGQ3ZjBlNjIyY2Q2MDM5NTAyYzIyZTU1NmM0MTdlOTBkMDk) link to join the Slack workspace.
|
@ -7,7 +7,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Prepare",
|
"name": "Prepare",
|
||||||
"imageUrl": "/static/lessons/firmware.png",
|
"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!",
|
"label": "New? Start Here!",
|
||||||
"labelClass": "red ribbon large",
|
"labelClass": "red ribbon large",
|
||||||
"url": "https://makecode.mindstorms.com/troubleshoot"
|
"url": "https://makecode.mindstorms.com/troubleshoot"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v0.4.2"
|
"appref": "v1.0.8"
|
||||||
}
|
}
|
||||||
|
@ -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:
|
Follow the steps of the _Maker Design Process_ for this lesson:
|
||||||
|
|
||||||
| | |
|
* Define the Problem
|
||||||
|-|-|
|
* Brainstorming
|
||||||
|  | **Define the Problem** |
|
* Define the Design Criteria
|
||||||
|  | **Brainstorming** |
|
* Go Make
|
||||||
|  | **Define the Design Criteria** |
|
* Review and Revise Your Solution
|
||||||
|  | **Go Make** |
|
* Communicate Your Solution
|
||||||
|  | **Review and Revise Your Solution** |
|
|
||||||
|  | **Communicate Your Solution** |
|
|
||||||
|
|
||||||
### Defining the Problem
|
### Defining the Problem
|
||||||
|
|
||||||
|
@ -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:
|
Follow the steps of the _Maker Design Process_ for this lesson:
|
||||||
|
|
||||||
| | |
|
* Define the Problem
|
||||||
|-|-|
|
* Brainstorming
|
||||||
|  | **Define the Problem** |
|
* Define the Design Criteria
|
||||||
|  | **Brainstorming** |
|
* Go Make
|
||||||
|  | **Define the Design Criteria** |
|
* Review and Revise Your Solution
|
||||||
|  | **Go Make** |
|
* Communicate Your Solution
|
||||||
|  | **Review and Revise Your Solution** |
|
|
||||||
|  | **Communicate Your Solution** |
|
|
||||||
|
|
||||||
### Defining the Problem
|
### Defining the Problem
|
||||||
|
|
||||||
|
@ -388,12 +388,12 @@
|
|||||||
}
|
}
|
||||||
function downloadWin64() {
|
function downloadWin64() {
|
||||||
// TODO: Keep this link up-to-date with the desired release version
|
// 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.8/win64");
|
||||||
tickEvent("offlineapp.download", { "target": "ev3", "platform": "win64" });
|
tickEvent("offlineapp.download", { "target": "ev3", "platform": "win64" });
|
||||||
}
|
}
|
||||||
function downloadMac64() {
|
function downloadMac64() {
|
||||||
// TODO: Keep this link up-to-date with the desired release version
|
// 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.8/mac64");
|
||||||
tickEvent("offlineapp.download", { "target": "ev3", "platform": "mac64" });
|
tickEvent("offlineapp.download", { "target": "ev3", "platform": "mac64" });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -461,25 +461,19 @@
|
|||||||
<p class="c2">
|
<p class="c2">
|
||||||
<span class="c5 c1">3.</span>
|
<span class="c5 c1">3.</span>
|
||||||
<span class="c1"> </span>
|
<span class="c1"> </span>
|
||||||
<span class="c5 c1">Associated Online Services.</span>
|
<span class="c5 c1">ASSOCIATED ONLINE SERVICES.</span>
|
||||||
<span class="c1"> Some features of the software may provide access
|
<span class="c1"> Some features of the software provide access
|
||||||
to, or rely on, Azure online services, including an associated Azure online service to the software
|
to, or rely on, online services to provide you information about updates to the software or extensions,
|
||||||
currently in development (the “corresponding service”). The use of those services
|
or to enable you to retrieve content, collaborate with others, or otherwise supplement your development
|
||||||
(but not the software) is governed by the separate terms and privacy policies in the agreement
|
experience. As used throughout these license terms, the term <q>software</q> includes these online
|
||||||
under which you obtained the Azure services at</span>
|
services and features. By using these online services and features you consent to the to the
|
||||||
<span class="c1">
|
transmission of information as described in Section 5, DATA.
|
||||||
<a class="c9" href="https://www.google.com/url?q=https://go.microsoft.com/fwLink/p/?LinkID%3D233178&sa=D&ust=1529596153826000"> </a>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="c1 c18">
|
|
||||||
<a class="c9" href="https://www.google.com/url?q=https://go.microsoft.com/fwLink/p/?LinkID%3D233178&sa=D&ust=1529596153826000">https://go.microsoft.com/fwLink/p/?LinkID=233178</a>
|
|
||||||
</span>
|
|
||||||
<span class="c3 c1"> (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>
|
||||||
<p class="c2">
|
<p class="c2">
|
||||||
<span class="c5 c1">4.</span>
|
<span class="c5 c1">4.</span>
|
||||||
<span class="c1"> </span>
|
<span class="c1"> </span>
|
||||||
<span class="c5 c1">Licenses for other components.</span>
|
<span class="c5 c1">LICENSES FOR OTHER COMPONENTS.</span>
|
||||||
<span class="c3 c1"> The software may include third party components with separate legal notices or governed by
|
<span class="c3 c1"> 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
|
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
|
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
|
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>
|
and use in the help documentation and the privacy statement at </span>
|
||||||
<span class="c14 c1">
|
<span class="c14 c1">
|
||||||
<a class="c9" href="https://www.google.com/url?q=http://go.microsoft.com/fwlink/?LinkId%3D398505&sa=D&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>
|
||||||
<span class="c1">.</span>
|
<span class="c1">.</span>
|
||||||
<span class="c3 c1"> Your use of the software operates as your consent to these practices.</span>
|
<span class="c3 c1"> 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
|
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>
|
of the Online Services Terms to all customers effective May 25, 2018, at </span>
|
||||||
<span class="c1 c14">
|
<span class="c1 c14">
|
||||||
<a class="c9" href="https://www.google.com/url?q=http://go.microsoft.com/?linkid%3D9840733&sa=D&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>
|
||||||
<span class="c3 c1">.</span>
|
<span class="c3 c1">.</span>
|
||||||
</p>
|
</p>
|
||||||
@ -794,4 +788,4 @@
|
|||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
BIN
docs/static/fll/context-help.jpg
vendored
Normal file
BIN
docs/static/fll/context-help.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
docs/static/fll/fll-logo.png
vendored
Normal file
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
BIN
docs/static/fll/import-button.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
BIN
docs/static/fll/save-project.jpg
vendored
Normal file
BIN
docs/static/fll/save-project.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
docs/static/fll/share-program.jpg
vendored
Normal file
BIN
docs/static/fll/share-program.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
@ -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``.
|
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``.
|
||||||
|
|
||||||
| | | |
|

|
||||||
|-|-|-|
|
<br/>
|
||||||
|  | | |  |
|

|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
|
brick.buttonUp.onEvent(ButtonEvent.Pressed, function () {
|
||||||
|
33
docs/videos.md
Normal file
33
docs/videos.md
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
@ -30,7 +30,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
|
|||||||
<div class="ui header">${lf("First time here?")}</div>
|
<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>
|
<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;">
|
<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>
|
</div>
|
||||||
<a href="/troubleshoot" target="_blank">${lf("Check your firmware version here and update if needed")}</a>
|
<a href="/troubleshoot" target="_blank">${lf("Check your firmware version here and update if needed")}</a>
|
||||||
</div>
|
</div>
|
||||||
@ -42,7 +42,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
|
|||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="ui">
|
<div class="ui">
|
||||||
<div class="image">
|
<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>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="description">
|
<div class="description">
|
||||||
@ -57,7 +57,7 @@ pxt.editor.initExtensionsAsync = function (opts: pxt.editor.ExtensionOptions): P
|
|||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="ui">
|
<div class="ui">
|
||||||
<div class="image">
|
<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>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="description">
|
<div class="description">
|
||||||
|
@ -133,14 +133,27 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
|||||||
this.setText(text);
|
this.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFirstValue(text: string) {
|
getFirstValue(value: string) {
|
||||||
// Get first set of words up until last space
|
const typeValue = value.indexOf('large') != -1 ? 'large' : 'medium';
|
||||||
return this.normalizeText_(text.substring(0, text.lastIndexOf(' ')));
|
const portValue = this.getSecondValue(value);
|
||||||
|
const isDual = portValue.length > 1;
|
||||||
|
return `${typeValue} motor${isDual ? 's' : ''}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSecondValue(text: string) {
|
getSecondValue(value: string) {
|
||||||
// Get last word
|
return (value.indexOf('large') != -1) ?
|
||||||
return this.normalizeText_(text.match(/\S*$/)[0]);
|
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) {
|
private normalizeText_(text: string) {
|
||||||
@ -198,8 +211,8 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
|||||||
if (text === null) {
|
if (text === null) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
if (text.indexOf(' ') == -1) {
|
if (text.indexOf('|') == -1) {
|
||||||
text = `large motors ${text}`;
|
text = this.sourceBlock_.RTL ? `${text}|${lf("large motors")}` : `${lf("large motors")}|${text}`;
|
||||||
}
|
}
|
||||||
return 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.textElement_));
|
||||||
goog.dom.removeChildren(/** @type {!Element} */(this.textElement2_));
|
goog.dom.removeChildren(/** @type {!Element} */(this.textElement2_));
|
||||||
|
|
||||||
var text = this.text_;
|
|
||||||
text = this.patchDualMotorText(text);
|
|
||||||
|
|
||||||
// First dropdown
|
// 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);
|
this.textElement_.appendChild(textNode1);
|
||||||
|
|
||||||
// Second dropdown
|
// Second dropdown, no need to translate. Only port numbers
|
||||||
if (this.textElement2_) {
|
if (this.textElement2_) {
|
||||||
const textNode2 = document.createTextNode(this.getSecondValue(text));
|
const textNode2 = document.createTextNode(this.getSecondValue(this.value_));
|
||||||
this.textElement2_.appendChild(textNode2);
|
this.textElement2_.appendChild(textNode2);
|
||||||
}
|
}
|
||||||
this.updateWidth();
|
this.updateWidth();
|
||||||
@ -402,29 +413,28 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
|||||||
contentDiv.setAttribute('aria-haspopup', 'true');
|
contentDiv.setAttribute('aria-haspopup', 'true');
|
||||||
let options = this.getOptions();
|
let options = this.getOptions();
|
||||||
|
|
||||||
// Hashmap of options
|
|
||||||
let opts = {};
|
let opts = {};
|
||||||
let conts = {};
|
let conts = {};
|
||||||
let vals = {};
|
let vals = {};
|
||||||
|
// Go through all option values and split them into groups
|
||||||
for (let opt = 0; opt < options.length; opt++) {
|
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 value = options[opt][1];
|
||||||
const firstValue = this.getFirstValue(text);
|
const motorValue = value.substring(value.indexOf('.') + 1);
|
||||||
const secondValue = this.getSecondValue(text);
|
const typeValue = motorValue.indexOf('large') == 0 ? 'large' : 'medium';
|
||||||
if (!opts[firstValue]) opts[firstValue] = [secondValue];
|
const portValue = motorValue.indexOf('large') == 0 ? motorValue.substring(5) : motorValue.substring(6);
|
||||||
else opts[firstValue].push(secondValue);
|
const isDual = portValue.length > 1;
|
||||||
// Store a hash of the original key value pairs for later
|
|
||||||
|
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];
|
conts[text] = options[opt][0];
|
||||||
vals[text] = value;
|
vals[text] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentFirst = this.getFirstValue(this.text_);
|
const currentFirst = this.getFirstValue(this.value_);
|
||||||
const currentSecond = this.getSecondValue(this.text_);
|
const currentSecond = this.getSecondValue(this.value_);
|
||||||
|
|
||||||
if (!this.isFirst_) {
|
if (!this.isFirst_) {
|
||||||
options = opts[currentFirst];
|
options = opts[currentFirst];
|
||||||
@ -432,9 +442,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
|||||||
options = Object.keys(opts);
|
options = Object.keys(opts);
|
||||||
// Flip the first and second options to make it sorted the way we want it (medium, large, dual)
|
// Flip the first and second options to make it sorted the way we want it (medium, large, dual)
|
||||||
if (options.length == 3) {
|
if (options.length == 3) {
|
||||||
const temp = options[1];
|
options = [lf("medium motor"), lf("large motor"), lf("large motors")];
|
||||||
options[1] = options[0];
|
|
||||||
options[0] = temp;
|
|
||||||
} else {
|
} else {
|
||||||
options.reverse();
|
options.reverse();
|
||||||
}
|
}
|
||||||
@ -448,7 +456,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
|||||||
const columns = options.length;
|
const columns = options.length;
|
||||||
|
|
||||||
for (let i = 0, option: any; option = options[i]; i++) {
|
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, ' ');
|
text = text.replace(/\xA0/g, ' ');
|
||||||
const content: any = conts[text];
|
const content: any = conts[text];
|
||||||
const value = vals[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('id', ':' + i); // For aria-activedescendant
|
||||||
button.setAttribute('role', 'menuitem');
|
button.setAttribute('role', 'menuitem');
|
||||||
button.setAttribute('class', 'blocklyDropDownButton');
|
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.width = ((this.itemWidth_) - 8) + 'px';
|
||||||
button.style.height = ((this.itemWidth_) - 8) + 'px';
|
button.style.height = ((this.itemWidth_) - 8) + 'px';
|
||||||
let backgroundColor = this.backgroundColour_;
|
let backgroundColor = this.backgroundColour_;
|
||||||
@ -495,7 +503,15 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
|||||||
contentDiv.removeAttribute('aria-activedescendant');
|
contentDiv.removeAttribute('aria-activedescendant');
|
||||||
});
|
});
|
||||||
let buttonImg = document.createElement('img');
|
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;
|
//buttonImg.alt = icon.alt;
|
||||||
// Upon click/touch, we will be able to get the clicked element as e.target
|
// 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.
|
// Store a data attribute on all possible click targets so we can match it to the icon.
|
||||||
|
@ -368,7 +368,8 @@ namespace motors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private __move(steps: boolean, stepsOrTime: number, speed: number) {
|
private __move(steps: boolean, stepsOrTime: number, speed: number) {
|
||||||
step(this._port, {
|
control.dmesg("motor.__move")
|
||||||
|
const p = {
|
||||||
useSteps: steps,
|
useSteps: steps,
|
||||||
step1: 0,
|
step1: 0,
|
||||||
step2: stepsOrTime,
|
step2: stepsOrTime,
|
||||||
@ -376,7 +377,10 @@ namespace motors {
|
|||||||
speed: this._regulated ? speed : undefined,
|
speed: this._regulated ? speed : undefined,
|
||||||
power: this._regulated ? undefined : speed,
|
power: this._regulated ? undefined : speed,
|
||||||
useBrake: this._brake
|
useBrake: this._brake
|
||||||
})
|
};
|
||||||
|
control.dmesg("motor.1")
|
||||||
|
step(this._port, p)
|
||||||
|
control.dmesg("motor.__move end")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -706,24 +710,36 @@ namespace motors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function step(out: Output, opts: StepOptions) {
|
function step(out: Output, opts: StepOptions) {
|
||||||
|
control.dmesg('step')
|
||||||
let op = opts.useSteps ? DAL.opOutputStepSpeed : DAL.opOutputTimeSpeed
|
let op = opts.useSteps ? DAL.opOutputStepSpeed : DAL.opOutputTimeSpeed
|
||||||
let speed = opts.speed
|
let speed = opts.speed
|
||||||
if (speed == null) {
|
if (undefined == speed) {
|
||||||
speed = opts.power
|
speed = opts.power
|
||||||
op = opts.useSteps ? DAL.opOutputStepPower : DAL.opOutputTimePower
|
op = opts.useSteps ? DAL.opOutputStepPower : DAL.opOutputTimePower
|
||||||
if (speed == null)
|
if (undefined == speed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
speed = Math.clamp(-100, 100, speed)
|
speed = Math.clamp(-100, 100, speed)
|
||||||
|
control.dmesg('speed: ' + speed)
|
||||||
|
|
||||||
let b = mkCmd(out, op, 15)
|
let b = mkCmd(out, op, 15)
|
||||||
|
control.dmesg('STEP 5')
|
||||||
b.setNumber(NumberFormat.Int8LE, 2, speed)
|
b.setNumber(NumberFormat.Int8LE, 2, speed)
|
||||||
// note that b[3] is padding
|
// note that b[3] is padding
|
||||||
|
control.dmesg('STEP 1')
|
||||||
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 0, opts.step1)
|
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 0, opts.step1)
|
||||||
|
control.dmesg('STEP 2')
|
||||||
b.setNumber(NumberFormat.Int32LE, 4 + 4 * 1, opts.step2)
|
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.Int32LE, 4 + 4 * 2, opts.step3)
|
||||||
b.setNumber(NumberFormat.Int8LE, 4 + 4 * 3, opts.useBrake ? 1 : 0)
|
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)
|
writePWM(b)
|
||||||
|
control.dmesg('end step')
|
||||||
}
|
}
|
||||||
|
|
||||||
const types = [0, 0, 0, 0]
|
const types = [0, 0, 0, 0]
|
||||||
|
@ -9,5 +9,5 @@ sensors.ultrasonic1.pauseUntil(UltrasonicSensorEvent.ObjectDetected);
|
|||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
[on event](/reference/sensors/ultrasonic/on-event),
|
[on event](/reference/sensors/ultrasonic/on-event),
|
||||||
[distance](reference/sensors/ultrasonic/distance),
|
[distance](/reference/sensors/ultrasonic/distance),
|
||||||
[pause until](reference/sensors/ultrasonic/pause-until)
|
[pause until](/reference/sensors/ultrasonic/pause-until)
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-ev3",
|
"name": "pxt-ev3",
|
||||||
"version": "1.0.2",
|
"version": "1.0.9",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-ev3",
|
"name": "pxt-ev3",
|
||||||
"version": "1.0.2",
|
"version": "1.0.9",
|
||||||
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
|
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
|
||||||
"private": true,
|
"private": true,
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -39,8 +39,8 @@
|
|||||||
"webfonts-generator": "^0.4.0"
|
"webfonts-generator": "^0.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-common-packages": "0.23.55",
|
"pxt-common-packages": "0.23.56",
|
||||||
"pxt-core": "4.0.2"
|
"pxt-core": "4.0.9"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
"streams": true,
|
"streams": true,
|
||||||
"aspectRatio": 0.5,
|
"aspectRatio": 0.5,
|
||||||
"parts": false,
|
"parts": false,
|
||||||
"enableTrace": true,
|
|
||||||
"boardDefinition": {
|
"boardDefinition": {
|
||||||
"visual": "ev3"
|
"visual": "ev3"
|
||||||
}
|
}
|
||||||
@ -108,6 +107,7 @@
|
|||||||
"zh-CN"
|
"zh-CN"
|
||||||
],
|
],
|
||||||
"highContrast": true,
|
"highContrast": true,
|
||||||
|
"lightToc": true,
|
||||||
"docMenu": [
|
"docMenu": [
|
||||||
{
|
{
|
||||||
"name": "Support",
|
"name": "Support",
|
||||||
@ -137,7 +137,6 @@
|
|||||||
"invertedMonaco": false,
|
"invertedMonaco": false,
|
||||||
"monacoToolbox": true,
|
"monacoToolbox": true,
|
||||||
"invertedToolbox": false,
|
"invertedToolbox": false,
|
||||||
"lightToc": true,
|
|
||||||
"coloredToolbox": true,
|
"coloredToolbox": true,
|
||||||
"hasAudio": true,
|
"hasAudio": true,
|
||||||
"saveInMenu": true,
|
"saveInMenu": true,
|
||||||
@ -178,7 +177,8 @@
|
|||||||
"monacoColors": {
|
"monacoColors": {
|
||||||
"editor.background": "#f9f9f9"
|
"editor.background": "#f9f9f9"
|
||||||
},
|
},
|
||||||
"fileNameExclusiveFilter": "[^a-zA-Z0-9]"
|
"fileNameExclusiveFilter": "[^a-zA-Z0-9]",
|
||||||
|
"enableTrace": true
|
||||||
},
|
},
|
||||||
"ignoreDocsErrors": true
|
"ignoreDocsErrors": true
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,10 @@
|
|||||||
"Tutorials": "tutorials",
|
"Tutorials": "tutorials",
|
||||||
"Design Engineering": "design-engineering",
|
"Design Engineering": "design-engineering",
|
||||||
"Coding": "coding",
|
"Coding": "coding",
|
||||||
"Maker": "maker"
|
"Maker": "maker",
|
||||||
|
"Videos": "videos"
|
||||||
},
|
},
|
||||||
"electronManifest": {
|
"electronManifest": {
|
||||||
"latest": "v0.4.2"
|
"latest": "v1.0.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user