Compare commits

..

18 Commits

Author SHA1 Message Date
Peli de Halleux
8fd0bf92fa move electron to v1.1.22 2019-10-07 14:23:34 -07:00
Peli de Halleux
a33bff0520 offline template 2019-10-07 14:22:05 -07:00
Peli de Halleux
7549f865d6 move master to 1.2.22 2019-10-02 13:59:58 -07:00
Peli de Halleux
a5de9d88bb adding latest video 2019-10-02 13:53:22 -07:00
Peli de Halleux
0437df10de 1.2.22 2019-10-02 13:27:53 -07:00
Peli de Halleux
2079173dfa lock execution thread before exiting (#935) 2019-10-02 12:40:45 -07:00
Peli de Halleux
018a1e7528 added proportional line follower 2019-10-02 12:26:51 -07:00
Peli de Halleux
757f95d984 move master to v1.2.21 2019-10-02 10:59:50 -07:00
Peli de Halleux
8bc3fdc8ba 1.2.21 2019-10-01 15:56:22 -07:00
Peli de Halleux
e8a1e73cf5 1.2.20 2019-10-01 14:54:42 -07:00
Peli de Halleux
e9b2b239ad More gyro lessons (#933)
* updated pauseuntil

* updated youtube link

* updated docs
2019-10-01 14:54:17 -07:00
Peli de Halleux
5ad2288a9f updated docs 2019-10-01 13:38:33 -07:00
Peli de Halleux
92d13ef343 updated bluetooth info 2019-10-01 13:36:53 -07:00
Peli de Halleux
471ca5d915 1.2.19 2019-10-01 13:28:01 -07:00
Peli de Halleux
f745079728 Don't reset threashold when resetting color mode (#932)
* don't reset threshold when changing modes

* updated docs
2019-10-01 13:27:37 -07:00
Peli de Halleux
d179f18ef3 added gyro movies 2019-10-01 11:05:44 -07:00
Peli de Halleux
805fc6c787 1.2.18 2019-10-01 10:12:21 -07:00
Peli de Halleux
374bbb8304 Drift-compensated angle in gyro (#931)
* compute angle based on undrifted rate

* add is calibrating function

* fix integrator

* added example

* docs

* poll faster
2019-10-01 10:11:58 -07:00
22 changed files with 566 additions and 238 deletions

View File

@@ -6,13 +6,13 @@
<a class="item" href="https://makecode.com/privacy" target="_blank" rel="noopener">Privacy &amp; Cookies</a> <a class="item" href="https://makecode.com/privacy" target="_blank" rel="noopener">Privacy &amp; Cookies</a>
<a class="item" href="https://makecode.com/termsofuse" target="_blank" rel="noopener"> Terms Of Use</a> <a class="item" href="https://makecode.com/termsofuse" target="_blank" rel="noopener"> Terms Of Use</a>
<a class="item" href="https://makecode.com/trademarks" target="_blank" rel="noopener">Trademarks</a> <a class="item" href="https://makecode.com/trademarks" target="_blank" rel="noopener">Trademarks</a>
<div class="item">© 2018 Microsoft</div> <div class="item">©2019 Microsoft</div>
</div> </div>
<div class="ui container horizontal small divided link list"> <div class="ui container horizontal small divided link list">
<a class="ui centered item" href="https://makecode.com/" title="Microsoft MakeCode" target="_blank" rel="noopener">Powered by Microsoft MakeCode</a> <a class="ui centered item" href="https://makecode.com/" title="Microsoft MakeCode" target="_blank" rel="noopener">Powered by Microsoft MakeCode</a>
</div> </div>
<div class="ui centered container small list"> <div class="ui centered container small list">
<p class="item">LEGO, the LEGO logo, MINDSTORMS and the MINDSTORMS EV3 logo are trademarks and/ or copyrights of the LEGO Group. ©2018 The LEGO Group. All rights reserved.</p> <p class="item">@copyrightText@</p>
</div> </div>
</div> </div>
</footer> </footer>

View File

@@ -38,10 +38,7 @@ Next you need to enable the experimental features (this may change in the future
## Download over Bluetooth ## Download over Bluetooth
* go to the **beta** editor https://makecode.mindstorms.com/beta * go to https://makecode.mindstorms.com/
This feature is not yet released so make sure to use the beta editor.
* click on **Download** to start a file download as usual * click on **Download** to start a file download as usual
* on the download dialog, you should see a **Bluetooth** button. Click on the * on the download dialog, you should see a **Bluetooth** button. Click on the
**Bluetooth** button to enable the mode. **Bluetooth** button to enable the mode.
@@ -51,8 +48,9 @@ This feature is not yet released so make sure to use the beta editor.
## Choosing the correct serial port ## Choosing the correct serial port
Unfortunately, the browser dialog does not make it easy to select which serial port is the brick. Unfortunately, the browser dialog does not make it easy to select which serial port is the brick.
On Windows, it typically reads "Standard Serial over Bluetooth" and you may
have multiple of those if you've paired different bricks. * On Windows, choose ``Standard Serial over Bluetooth``. There might be multiple of those but only one works. Try your luck! Once you know the COM port number, remember it for the next time around.
* On Mac OS, choose ``cu.BRICKNAME-SerialPort``
## Known issues ## Known issues

View File

@@ -1,3 +1,3 @@
{ {
"appref": "v1.2.15" "appref": "v1.2.22"
} }

View File

@@ -3,11 +3,20 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>LEGO® MINDSTORMS® Education EV3 Offline App</title> <title>@name@ Offline App</title>
<meta name="Description" content="A MakeCode for LEGO® MINDSTORMS® Education EV3 offline app" /> <meta name="Description" content="A MakeCode for @name@ offline app" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- @include indexhead.html --> <link rel="stylesheet" data-rtl="/blb/rtlsemantic.css" href="/doccdn/semantic.css" />
<link rel="stylesheet" href="/docfiles/style.css" />
<link rel="stylesheet" href="/docfiles/target.css" />
<script src="/doccdn/jquery.js" type="text/javascript"></script>
<script src="/doccdn/semantic.js" type="text/javascript"></script>
<script src="/docfiles/target.js" type="text/javascript"></script>
<style>
@targetstyle@
</style>
<style> <style>
p.item { p.item {
color: rgba(0, 0, 0, 0.4); color: rgba(0, 0, 0, 0.4);
@@ -55,6 +64,10 @@
background-color: rgb(250, 250, 250); background-color: rgb(250, 250, 250);
} }
#legal-segment {
background:white;
}
@media only screen and (max-width: 800px) { @media only screen and (max-width: 800px) {
.grid .column .image { .grid .column .image {
display: none; display: none;
@@ -368,8 +381,8 @@
</style> </style>
<script> <script>
$(document).ready(function () { var electronLatestVersion = "";
tickEvent = function (id, data) { function tickEvent(id, data) {
if (!pxt.aiTrackEvent) return; if (!pxt.aiTrackEvent) return;
if (!data) pxt.aiTrackEvent(id); if (!data) pxt.aiTrackEvent(id);
else { else {
@@ -381,21 +394,48 @@
pxt.aiTrackEvent(id, props, measures); pxt.aiTrackEvent(id, props, measures);
} }
} }
});
function agreeCheckboxChanged() { function agreeCheckboxChanged() {
var downloadSegment = document.getElementById("download-segment"); showDownloads();
downloadSegment.classList.toggle("hidden"); }
function showAgree() {
$("#agree-segment").removeClass("hidden");
$("#read-segment").removeClass("hidden");
$("#legal-segment").removeClass("hidden");
}
function showNoDownloads() {
$("#no-download-segment").removeClass("hidden");
$("#read-segment").addClass("hidden");
$("#legal-segment").addClass("hidden");
}
function showDownloads() {
$("#download-win64").attr("href", "https://makecode.com/api/release/@targetid@/" + electronLatestVersion + "/win64");
$("#download-mac64").attr("href", "https://makecode.com/api/release/@targetid@/" + electronLatestVersion + "/mac64");
$("#download-segment").removeClass("hidden");
} }
function downloadWin64() { function downloadWin64() {
// TODO: Keep this link up-to-date with the desired release version tickEvent("offlineapp.download", { "target": "@targetid@", "platform": "win64" });
window.open("https://makecode.com/api/release/ev3/v1.1.20/win64");
tickEvent("offlineapp.download", { "target": "ev3", "platform": "win64" });
} }
function downloadMac64() { function downloadMac64() {
// TODO: Keep this link up-to-date with the desired release version tickEvent("offlineapp.download", { "target": "@targetid@", "platform": "mac64" });
window.open("https://makecode.com/api/release/ev3/v1.1.20/mac64");
tickEvent("offlineapp.download", { "target": "ev3", "platform": "mac64" });
} }
$(function () {
$.getJSON("https://makecode.com/api/config/@targetid@/targetconfig")
.then(function (data) {
if (data && data.electronManifest && data.electronManifest.latest) {
electronLatestVersion = data.electronManifest.latest;
showAgree();
} else {
showNoDownloads();
}
})
.catch(function () {
showNoDownloads();
})
});
</script> </script>
</head> </head>
@@ -406,35 +446,39 @@
<div class="ui grid topbar"> <div class="ui grid topbar">
<div class="three wide column"> <div class="three wide column">
<img class="ui small image left" src="/static//lego_education_logo_white.png" /> <img class="ui small image left" src="@cardLogo@" />
</div> </div>
<div class="ten wide column"> <div class="ten wide column">
<h1 class="ui inverted welcomeheader">MakeCode Offline App</h1> <h1 class="ui inverted welcomeheader">@name@ Offline App</h1>
</div> </div>
<div class="three wide column"> <div class="three wide column">
<img class="ui small image right" src="/static//Microsoft-logo_rgb_c-white.png" /> <img class="ui small image right" src="/static/Microsoft-logo_rgb_c-white.png" />
</div> </div>
</div> </div>
<div class="ui compact segments terms-container"> <div id="segments" class="ui compact segments terms-container">
<div class="ui secondary center aligned segment"> <div id="read-segment" class="ui secondary center aligned segment hidden">
Please read and accept the following terms to download the app. Please read and accept the following terms to download the app.
</div> </div>
<div class="ui left aligned segment terms"> <div id="legal-segment" class="ui left aligned segment terms hidden">
<div id="loader" class="ui active loader"></div>
<div class="c17"> <div class="c17">
<p class="c11"> <p class="c11">
<span class="c4 c1">MICROSOFT PRE-RELEASE SOFTWARE LICENSE TERMS</span> <span class="c4 c1">MICROSOFT PRE-RELEASE SOFTWARE LICENSE TERMS</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c4 c1">MICROSOFT MAKECODE FOR LEGO MINDSTORMS EDUCATION EV3</span> <span class="c4 c1">MICROSOFT MAKECODE SOFTWARE FOR @name@</span>
</p> </p>
<p class="c7"> <p class="c7">
<span class="c4 c1"></span> <span class="c4 c1"></span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c3 c1">These license terms are an agreement between Microsoft Corporation (or based on where you live, one <span class="c3 c1">These license terms are an agreement between Microsoft Corporation (or based
of its affiliates) and you. They apply to the software named above. The terms also apply to any on where you live, one
Microsoft services or updates for the software, except to the extent those have additional terms.</span> of its affiliates) and you. They apply to the software named above. The terms also apply to
any
Microsoft services or updates for the software, except to the extent those have additional
terms.</span>
</p> </p>
<p class="c7"> <p class="c7">
<span class="c3 c1"></span> <span class="c3 c1"></span>
@@ -446,26 +490,34 @@
<span class="c5 c1">1.</span> <span class="c5 c1">1.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">INSTALLATION AND USE RIGHTS. </span> <span class="c5 c1">INSTALLATION AND USE RIGHTS. </span>
<span class="c3 c1">You may install and use any number of copies of the software to evaluate it as you develop and test <span class="c3 c1">You may install and use any number of copies of the software to evaluate it
your software applications for use with Lego Mindstorms Education EV3 hardware.</span> as you develop and test
your software applications for use with @name@ hardware.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">2.</span> <span class="c5 c1">2.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">PRE-RELEASE SOFTWARE. </span> <span class="c5 c1">PRE-RELEASE SOFTWARE. </span>
<span class="c3 c1">The software is a pre-release version. It may not work the way a final version of the software will. <span class="c3 c1">The software is a pre-release version. It may not work the way a final
Microsoft may change it for the final, commercial version. We also may not release a commercial version of the software will.
version. Microsoft is not obligated to provide maintenance, technical support or updates to you Microsoft may change it for the final, commercial version. We also may not release a
commercial
version. Microsoft is not obligated to provide maintenance, technical support or updates to
you
for the software.</span> for the software.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">3.</span> <span class="c5 c1">3.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">ASSOCIATED ONLINE SERVICES.</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 provide access <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Some features of the software
to, or rely on, online services to provide you information about updates to the software or extensions, provide access
or to enable you to retrieve content, collaborate with others, or otherwise supplement your development to, or rely on, online services to provide you information about updates to the software or
experience. As used throughout these license terms, the term <q>software</q> includes these online 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 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. transmission of information as described in Section 5, DATA.
</span> </span>
@@ -474,9 +526,11 @@
<span class="c5 c1">4.</span> <span class="c5 c1">4.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 <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 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
exclusions of damages below also apply.</span> exclusions of damages below also apply.</span>
</p> </p>
<p class="c2"> <p class="c2">
@@ -488,26 +542,35 @@
<span class="c5 c1">a.</span> <span class="c5 c1">a.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c1 c5">Data Collection. </span> <span class="c1 c5">Data Collection. </span>
<span class="c1">The software may collect information about you and your use of the software, and send that to Microsoft. <span class="c1">The software may collect information about you and your use of the software,
Microsoft may use this information to provide services and improve our products and services. and send that to Microsoft.
You may opt out of many of these scenarios, but not all, as described in the product documentation. Microsoft may use this information to provide services and improve our products and
In using the software, you must comply with applicable law. You can learn more about data collection services.
You may opt out of many of these scenarios, but not all, as described in the product
documentation.
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="http://go.microsoft.com/fwlink/?LinkId=398505">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">&nbsp;Your use of the software operates as your consent to these practices.</span> <span class="c3 c1">&nbsp;Your use of the software operates as your consent to these
practices.</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c5 c1">b.</span> <span class="c5 c1">b.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">Processing of Personal Data. </span> <span class="c5 c1">Processing of Personal Data. </span>
<span class="c1">To the extent Microsoft is a processor or subprocessor of personal data in connection with the software, <span class="c1">To the extent Microsoft is a processor or subprocessor of personal data in
Microsoft makes the commitments in the European Union General Data Protection Regulation Terms connection with the software,
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="http://go.microsoft.com/?linkid=9840733">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>
@@ -515,48 +578,62 @@
<span class="c5 c1">6.</span> <span class="c5 c1">6.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">FEEDBACK. </span> <span class="c5 c1">FEEDBACK. </span>
<span class="c3 c1">If you give feedback about the software to Microsoft, you give to Microsoft, without charge, the <span class="c3 c1">If you give feedback about the software to Microsoft, you give to Microsoft,
without charge, the
right to use, share and commercialize your feedback in any way and for any purpose. You will right to use, share and commercialize your feedback in any way and for any purpose. You will
not give feedback that is subject to a license that requires Microsoft to license its software not give feedback that is subject to a license that requires Microsoft to license its
or documentation to third parties because we include your feedback in them. These rights survive software
or documentation to third parties because we include your feedback in them. These rights
survive
this agreement.</span> this agreement.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">7.</span> <span class="c5 c1">7.</span>
<span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">SCOPE OF LICENSE.</span> <span class="c5 c1">SCOPE OF LICENSE.</span>
<span class="c3 c1">&nbsp;The software is licensed, not sold. This agreement only gives you some rights to use the software. <span class="c3 c1">&nbsp;The software is licensed, not sold. This agreement only gives you some
Microsoft reserves all other rights. Unless applicable law gives you more rights despite this rights to use the software.
Microsoft reserves all other rights. Unless applicable law gives you more rights despite
this
limitation, you may use the software only as expressly permitted in this agreement. &nbsp;In limitation, you may use the software only as expressly permitted in this agreement. &nbsp;In
doing so, you must comply with any technical limitations in the software that only allow you doing so, you must comply with any technical limitations in the software that only allow you
to use it in certain ways. You may not:</span> to use it in certain ways. You may not:</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; work around any technical limitations in the software;</span> <span class="c3 c1">- &nbsp; &nbsp; work around any technical limitations in the
software;</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; reverse engineer, decompile or disassemble the software, or attempt to do so, except <span class="c3 c1">- &nbsp; &nbsp; reverse engineer, decompile or disassemble the software, or
attempt to do so, except
and only to the extent required by third party licensing terms governing use of certain open and only to the extent required by third party licensing terms governing use of certain open
source components that may be included with the software;</span> source components that may be included with the software;</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; remove, minimize, block or modify any notices of Microsoft or its suppliers in the <span class="c3 c1">- &nbsp; &nbsp; remove, minimize, block or modify any notices of Microsoft
or its suppliers in the
software; software;
</span> </span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; use the software in any way that is against the law; or</span> <span class="c3 c1">- &nbsp; &nbsp; use the software in any way that is against the law;
or</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c3 c1">- &nbsp; &nbsp; share, publish, rent or lease the software, or provide the software as a stand-alone <span class="c3 c1">- &nbsp; &nbsp; share, publish, rent or lease the software, or provide the
software as a stand-alone
offering for others to use.</span> offering for others to use.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">8. &nbsp; UPDATES. </span> <span class="c5 c1">8. &nbsp; UPDATES. </span>
<span class="c3 c1">The software may periodically check for updates and download and install them for you. You may obtain <span class="c3 c1">The software may periodically check for updates and download and install
updates only from Microsoft or authorized sources. Microsoft may need to update your system to them for you. You may obtain
provide you with updates. You agree to receive these automatic updates without any additional updates only from Microsoft or authorized sources. Microsoft may need to update your system
notice. Updates may not include or support all existing software features, services, or peripheral to
provide you with updates. You agree to receive these automatic updates without any
additional
notice. Updates may not include or support all existing software features, services, or
peripheral
devices. devices.
</span> </span>
</p> </p>
@@ -564,57 +641,74 @@
<span class="c5 c1">9.</span> <span class="c5 c1">9.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">EXPORT RESTRICTIONS.</span> <span class="c5 c1">EXPORT RESTRICTIONS.</span>
<span class="c3 c1">&nbsp;You must comply with all domestic and international export laws and regulations that apply <span class="c3 c1">&nbsp;You must comply with all domestic and international export laws and
to the software, which include restrictions on destinations, end users and end use. For further regulations that apply
to the software, which include restrictions on destinations, end users and end use. For
further
information on export restrictions, visit (aka.ms/exporting).</span> information on export restrictions, visit (aka.ms/exporting).</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">10.</span> <span class="c5 c1">10.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">SUPPORT SERVICES. </span> <span class="c5 c1">SUPPORT SERVICES. </span>
<span class="c3 c1">Because the software is &ldquo;as is,&rdquo; we may not provide support services for it.</span> <span class="c3 c1">Because the software is &ldquo;as is,&rdquo; we may not provide support
services for it.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">11.</span> <span class="c5 c1">11.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">ENTIRE AGREEMENT.</span> <span class="c5 c1">ENTIRE AGREEMENT.</span>
<span class="c3 c1">&nbsp;This agreement, and the terms for supplements, updates, Internet-based services and support <span class="c3 c1">&nbsp;This agreement, and the terms for supplements, updates, Internet-based
services that you use, are the entire agreement for the software and support services.</span> services and support
services that you use, are the entire agreement for the software and support
services.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">12.</span> <span class="c5 c1">12.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">APPLICABLE LAW. </span> <span class="c5 c1">APPLICABLE LAW. </span>
<span class="c3 c1">If you acquired the software in the United States, Washington State law applies to interpretation <span class="c3 c1">If you acquired the software in the United States, Washington State law
of and claims for breach of this agreement, and the laws of the state where you live apply to applies to interpretation
of and claims for breach of this agreement, and the laws of the state where you live apply
to
all other claims. If you acquired the software in any other country, its laws apply.</span> all other claims. If you acquired the software in any other country, its laws apply.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">13.</span> <span class="c5 c1">13.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">CONSUMER RIGHTS; REGIONAL VARIATIONS. </span> <span class="c5 c1">CONSUMER RIGHTS; REGIONAL VARIATIONS. </span>
<span class="c3 c1">This agreement describes certain legal rights. You may have other rights, including consumer rights, <span class="c3 c1">This agreement describes certain legal rights. You may have other rights,
under the laws of your state or country. Separate and apart from your relationship with Microsoft, including consumer rights,
you may also have rights with respect to the party from which you acquired the software. This under the laws of your state or country. Separate and apart from your relationship with
agreement does not change those other rights if the laws of your state or country do not permit Microsoft,
it to do so. For example, if you acquired the software in one of the below regions, or mandatory you may also have rights with respect to the party from which you acquired the software.
This
agreement does not change those other rights if the laws of your state or country do not
permit
it to do so. For example, if you acquired the software in one of the below regions, or
mandatory
country law applies, then the following provisions apply to you:</span> country law applies, then the following provisions apply to you:</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c5 c1">a.</span> <span class="c5 c1">a.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">Australia. </span> <span class="c5 c1">Australia. </span>
<span class="c3 c1">You have statutory guarantees under the Australian Consumer Law and nothing in this agreement is <span class="c3 c1">You have statutory guarantees under the Australian Consumer Law and nothing
in this agreement is
intended to affect those rights.</span> intended to affect those rights.</span>
</p> </p>
<p class="c8"> <p class="c8">
<span class="c5 c1">b.</span> <span class="c5 c1">b.</span>
<span class="c1">&nbsp; &nbsp;</span> <span class="c1">&nbsp; &nbsp;</span>
<span class="c5 c1">Canada. </span> <span class="c5 c1">Canada. </span>
<span class="c3 c1">If you acquired the software in Canada, you may stop receiving updates by turning off the automatic <span class="c3 c1">If you acquired the software in Canada, you may stop receiving updates by
update feature, disconnecting your device from the Internet (if and when you re-connect to the turning off the automatic
Internet, however, the software will resume checking for and installing updates), or uninstalling update feature, disconnecting your device from the Internet (if and when you re-connect to
the software. The product documentation, if any, may also specify how to turn off updates for the
Internet, however, the software will resume checking for and installing updates), or
uninstalling
the software. The product documentation, if any, may also specify how to turn off updates
for
your specific device or software.</span> your specific device or software.</span>
</p> </p>
<p class="c8"> <p class="c8">
@@ -627,8 +721,10 @@
<span class="c5 c1">(i)</span> <span class="c5 c1">(i)</span>
<span class="c1">&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">Warranty</span> <span class="c5 c1">Warranty</span>
<span class="c3 c1">. The properly licensed software will perform substantially as described in any Microsoft materials <span class="c3 c1">. The properly licensed software will perform substantially as described in
that accompany the software. However, Microsoft gives no contractual guarantee in relation to any Microsoft materials
that accompany the software. However, Microsoft gives no contractual guarantee in relation
to
the licensed software.</span> the licensed software.</span>
</p> </p>
<p class="c6"> <p class="c6">
@@ -638,74 +734,103 @@
<span class="c5 c1">(ii)</span> <span class="c5 c1">(ii)</span>
<span class="c1">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="c1">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="c5 c1">Limitation of Liability</span> <span class="c5 c1">Limitation of Liability</span>
<span class="c3 c1">. In case of intentional conduct, gross negligence, claims based on the Product Liability Act, as <span class="c3 c1">. In case of intentional conduct, gross negligence, claims based on the
well as, in case of death or personal or physical injury, Microsoft is liable according to the Product Liability Act, as
well as, in case of death or personal or physical injury, Microsoft is liable according to
the
statutory law.</span> statutory law.</span>
</p> </p>
<p class="c10"> <p class="c10">
<span class="c3 c1">Subject to the foregoing clause (ii), Microsoft will only be liable for slight negligence if Microsoft <span class="c3 c1">Subject to the foregoing clause (ii), Microsoft will only be liable for
is in breach of such material contractual obligations, the fulfillment of which facilitate the slight negligence if Microsoft
due performance of this agreement, the breach of which would endanger the purpose of this agreement is in breach of such material contractual obligations, the fulfillment of which facilitate
and the compliance with which a party may constantly trust in (so-called &quot;cardinal obligations&quot;). the
In other cases of slight negligence, Microsoft will not be liable for slight negligence.</span> due performance of this agreement, the breach of which would endanger the purpose of this
agreement
and the compliance with which a party may constantly trust in (so-called &quot;cardinal
obligations&quot;).
In other cases of slight negligence, Microsoft will not be liable for slight
negligence.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">14.</span> <span class="c5 c1">14.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c5 c1">LEGAL EFFECT.</span> <span class="c5 c1">LEGAL EFFECT.</span>
<span class="c3 c1">&nbsp;This agreement describes certain legal rights. You may have other rights under the laws of <span class="c3 c1">&nbsp;This agreement describes certain legal rights. You may have other
your country. You may also have rights with respect to the party from whom you acquired the software. rights under the laws of
This agreement does not change your rights under the laws of your country if the laws of your your country. You may also have rights with respect to the party from whom you acquired the
software.
This agreement does not change your rights under the laws of your country if the laws of
your
country do not permit it to do so.</span> country do not permit it to do so.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">15.</span> <span class="c5 c1">15.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c4 c1">DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED &ldquo;AS-IS.&rdquo; &nbsp;YOU BEAR THE RISK OF <span class="c4 c1">DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED &ldquo;AS-IS.&rdquo;
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT PERMITTED &nbsp;YOU BEAR THE RISK OF
USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. TO THE EXTENT
PERMITTED
UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.</span> FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c5 c1">16.</span> <span class="c5 c1">16.</span>
<span class="c1">&nbsp;</span> <span class="c1">&nbsp;</span>
<span class="c4 c1">LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT <span class="c4 c1">LIMITATION ON AND EXCLUSION OF DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND
DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST ITS SUPPLIERS ONLY DIRECT
DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL,
LOST
PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.</span> PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.</span>
</p> </p>
<p class="c0"> <p class="c0">
<span class="c3 c1">This limitation applies to (a) anything related to the software, services, content (including code) <span class="c3 c1">This limitation applies to (a) anything related to the software, services,
on third party Internet sites, or third party programs; and (b) claims for breach of contract, content (including code)
breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the on third party Internet sites, or third party programs; and (b) claims for breach of
contract,
breach of warranty, guarantee or condition, strict liability, negligence, or other tort to
the
extent permitted by applicable law.</span> extent permitted by applicable law.</span>
</p> </p>
<p class="c0"> <p class="c0">
<span class="c3 c1">It also applies even if Microsoft knew or should have known about the possibility of the damages. <span class="c3 c1">It also applies even if Microsoft knew or should have known about the
The above limitation or exclusion may not apply to you because your country may not allow the possibility of the damages.
The above limitation or exclusion may not apply to you because your country may not allow
the
exclusion or limitation of incidental, consequential or other damages.</span> exclusion or limitation of incidental, consequential or other damages.</span>
</p> </p>
<p class="c12"> <p class="c12">
<span class="c4 c1">Please note: As the software is distributed in Quebec, Canada, some of the clauses in this agreement <span class="c4 c1">Please note: As the software is distributed in Quebec, Canada, some of the
clauses in this agreement
are provided below in French.</span> are provided below in French.</span>
</p> </p>
<p class="c12"> <p class="c12">
<span class="c4 c1">Remarque : Ce logiciel &eacute;tant distribu&eacute; au Qu&eacute;bec, Canada, certaines des clauses <span class="c4 c1">Remarque : Ce logiciel &eacute;tant distribu&eacute; au Qu&eacute;bec,
Canada, certaines des clauses
dans ce contrat sont fournies ci-dessous en fran&ccedil;ais.</span> dans ce contrat sont fournies ci-dessous en fran&ccedil;ais.</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c5 c1">EXON&Eacute;RATION DE GARANTIE.</span> <span class="c5 c1">EXON&Eacute;RATION DE GARANTIE.</span>
<span class="c1 c3">&nbsp;Le logiciel vis&eacute; par une licence est offert &laquo; tel quel &raquo;. Toute utilisation <span class="c1 c3">&nbsp;Le logiciel vis&eacute; par une licence est offert &laquo; tel quel
de ce logiciel est &agrave; votre seule risque et p&eacute;ril. Microsoft n&rsquo;accorde aucune &raquo;. Toute utilisation
autre garantie expresse. Vous pouvez b&eacute;n&eacute;ficier de droits additionnels en vertu de ce logiciel est &agrave; votre seule risque et p&eacute;ril. Microsoft n&rsquo;accorde
du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles aucune
sont permises par le droit locale, les garanties implicites de qualit&eacute; marchande, d&rsquo;ad&eacute;quation autre garantie expresse. Vous pouvez b&eacute;n&eacute;ficier de droits additionnels en
vertu
du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou
elles
sont permises par le droit locale, les garanties implicites de qualit&eacute; marchande,
d&rsquo;ad&eacute;quation
&agrave; un usage particulier et d&rsquo;absence de contrefa&ccedil;on sont exclues. &agrave; un usage particulier et d&rsquo;absence de contrefa&ccedil;on sont exclues.
</span> </span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c5 c1">LIMITATION DES DOMMAGES-INT&Eacute;R&Ecirc;TS ET EXCLUSION DE RESPONSABILIT&Eacute; POUR LES DOMMAGES.</span> <span class="c5 c1">LIMITATION DES DOMMAGES-INT&Eacute;R&Ecirc;TS ET EXCLUSION DE
<span class="c3 c1">&nbsp;Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages RESPONSABILIT&Eacute; POUR LES DOMMAGES.</span>
directs uniquement &agrave; hauteur de 5,00 $ US. Vous ne pouvez pr&eacute;tendre &agrave; aucune <span class="c3 c1">&nbsp;Vous pouvez obtenir de Microsoft et de ses fournisseurs une
indemnisation en cas de dommages
directs uniquement &agrave; hauteur de 5,00 $ US. Vous ne pouvez pr&eacute;tendre &agrave;
aucune
indemnisation pour les autres dommages, y compris les dommages sp&eacute;ciaux, indirects ou indemnisation pour les autres dommages, y compris les dommages sp&eacute;ciaux, indirects ou
accessoires et pertes de b&eacute;n&eacute;fices.</span> accessoires et pertes de b&eacute;n&eacute;fices.</span>
</p> </p>
@@ -713,26 +838,36 @@
<span class="c3 c1">Cette limitation concerne :</span> <span class="c3 c1">Cette limitation concerne :</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; tout ce qui est reli&eacute; au logiciel, aux services ou au contenu <span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; tout ce qui est reli&eacute; au logiciel, aux
(y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et</span> services ou au contenu
(y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ;
et</span>
</p> </p>
<p class="c2"> <p class="c2">
<span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; les r&eacute;clamations au titre de violation de contrat ou de garantie, <span class="c3 c1">- &nbsp; &nbsp; &nbsp; &nbsp; les r&eacute;clamations au titre de violation
ou au titre de responsabilit&eacute; stricte, de n&eacute;gligence ou d&rsquo;une autre faute de contrat ou de garantie,
ou au titre de responsabilit&eacute; stricte, de n&eacute;gligence ou d&rsquo;une autre
faute
dans la limite autoris&eacute;e par la loi en vigueur.</span> dans la limite autoris&eacute;e par la loi en vigueur.</span>
</p> </p>
<p class="c12"> <p class="c12">
<span class="c3 c1">Elle s&rsquo;applique &eacute;galement, m&ecirc;me si Microsoft connaissait ou devrait conna&icirc;tre <span class="c3 c1">Elle s&rsquo;applique &eacute;galement, m&ecirc;me si Microsoft connaissait
ou devrait conna&icirc;tre
l&rsquo;&eacute;ventualit&eacute; d&rsquo;un tel dommage. Si votre pays n&rsquo;autorise pas l&rsquo;&eacute;ventualit&eacute; d&rsquo;un tel dommage. Si votre pays n&rsquo;autorise pas
l&rsquo;exclusion ou la limitation de responsabilit&eacute; pour les dommages indirects, accessoires l&rsquo;exclusion ou la limitation de responsabilit&eacute; pour les dommages indirects,
ou de quelque nature que ce soit, il se peut que la limitation ou l&rsquo;exclusion ci-dessus accessoires
ou de quelque nature que ce soit, il se peut que la limitation ou l&rsquo;exclusion
ci-dessus
ne s&rsquo;appliquera pas &agrave; votre &eacute;gard.</span> ne s&rsquo;appliquera pas &agrave; votre &eacute;gard.</span>
</p> </p>
<p class="c16"> <p class="c16">
<span class="c5 c1">EFFET JURIDIQUE.</span> <span class="c5 c1">EFFET JURIDIQUE.</span>
<span class="c3 c1">&nbsp;Le pr&eacute;sent contrat d&eacute;crit certains droits juridiques. Vous pourriez avoir d&rsquo;autres <span class="c3 c1">&nbsp;Le pr&eacute;sent contrat d&eacute;crit certains droits juridiques.
droits pr&eacute;vus par les lois de votre pays. Le pr&eacute;sent contrat ne modifie pas les Vous pourriez avoir d&rsquo;autres
droits que vous conf&egrave;rent les lois de votre pays si celles-ci ne le permettent pas.</span> droits pr&eacute;vus par les lois de votre pays. Le pr&eacute;sent contrat ne modifie pas
les
droits que vous conf&egrave;rent les lois de votre pays si celles-ci ne le permettent
pas.</span>
</p> </p>
<p class="c15"> <p class="c15">
<span class="c3 c1"></span> <span class="c3 c1"></span>
@@ -740,9 +875,9 @@
<p class="c16"> <p class="c16">
<span class="c3 c1">&nbsp;</span> <span class="c3 c1">&nbsp;</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c3 c1">LEGO, the LEGO logo, MINDSTORMS and the MINDSTORMS EV3 logo are trademarks and/ or copyrights of <span class="c3 c1">@copyrightText@</span>
the LEGO Group. &copy;2018 The LEGO Group. All rights reserved.</span>
</p> </p>
<p class="c11"> <p class="c11">
<span class="c3 c1">&nbsp;</span> <span class="c3 c1">&nbsp;</span>
@@ -755,27 +890,30 @@
</p> </p>
</div> </div>
</div> </div>
<div class="ui center aligned segment"> <div id="agree-segment" class="ui center aligned segment hidden">
<input id="agree-checkbox" type="checkbox" autocomplete="off" onchange="agreeCheckboxChanged(this)"> <input id="agree-checkbox" type="checkbox" autocomplete="off" onchange="agreeCheckboxChanged(this)">
<label for="agree-checkbox">I agree to these Microsoft Software License Terms and to the <label for="agree-checkbox">I agree to these Microsoft Software License Terms and to the
<a href="https://privacy.microsoft.com/en-us/privacystatement">Microsoft Privacy Statement.</a> <a href="https://privacy.microsoft.com/en-us/privacystatement">Microsoft Privacy Statement.</a>
</label> </label>
</div> </div>
<div id="no-download-segment" class="ui center aligned segment hidden">
<p>Sorry, there is no Offline App available for this editor.</p>
</div>
<div id="download-segment" class="ui center aligned segment hidden"> <div id="download-segment" class="ui center aligned segment hidden">
<div class="ui grid"> <div class="ui grid">
<div class="eight wide column"> <div class="eight wide column">
<h3 class="ui">Windows</h3> <h3 class="ui">Windows</h3>
<button class="ui icon button" onclick="downloadWin64()"> <a id="download-win64" class="ui icon button" onclick="downloadWin64()">
<i class="download icon"></i> <i class="download icon"></i>
makecode-ev3-setup-win64.exe makecode-@targetid@-setup-win64.exe
</button> </a>
</div> </div>
<div class="eight wide column"> <div class="eight wide column">
<h3 class="ui">Mac OS</h3> <h3 class="ui">Mac OS</h3>
<button class="ui icon button" onclick="downloadMac64()"> <a id="download-mac64" class="ui icon button" onclick="downloadMac64()">
<i class="download icon"></i> <i class="download icon"></i>
makecode-ev3-mac64.zip makecode-@targetid@-mac64.zip
</button> </a>
</div> </div>
</div> </div>
</div> </div>

BIN
docs/static/tutorials/drifter.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
docs/static/tutorials/turn-with-gyro.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -24,6 +24,26 @@
"name": "Bluetooth download (beta)", "name": "Bluetooth download (beta)",
"description": "EXPERIMENTAL! Learn how to download code via Bluetooth.", "description": "EXPERIMENTAL! Learn how to download code via Bluetooth.",
"youTubeId": "VIq8-6Egtqs" "youTubeId": "VIq8-6Egtqs"
}, {
"name": "Turn with Gyro",
"description": "Use the gyro for precise turns.",
"youTubeId": "I7ncuXAfBwk"
}, {
"name": "Moving with Gyro",
"description": "Use the gyro for correct the robot trajectory.",
"youTubeId": "ufiOPvW37xc"
}, {
"name": "Line following with 1 color sensor",
"description": "Simple line following using the color sensor.",
"youTubeId": "_LeduyKQVjg"
}, {
"name": "Proportional line following with 1 color sensor",
"description": "Proportional line following using the color sensor.",
"youTubeId": "-AirqwC9DL4"
}, {
"name": "Proportional line following with 2 color sensors",
"description": "Proportional line following using two color sensor.",
"youTubeId": "QWOflBuu9Oo"
}] }]
``` ```

34
docs/tutorials/drifter.md Normal file
View File

@@ -0,0 +1,34 @@
# Drifter
Use this program to try out the gyro sensor and the effect of drifting.
```typescript
// this loop shows the rate, angle and drift of the robot
forever(() => {
brick.showValue("rate", sensors.gyro2.rate(), 1)
brick.showValue("angle", sensors.gyro2.angle(), 2)
brick.showValue("drift", sensors.gyro2.drift(), 3)
})
// this loop shows wheter the sensor is calibrating
forever(() => {
brick.showString(sensors.gyro2.isCalibrating() ? "calibrating..." : "", 4)
})
// instructions on how to use the buttons
brick.showString("ENTER: calibrate", 7)
brick.showString(" (reset+drift)", 8)
brick.showString("LEFT: reset", 9)
brick.showString("RIGHT: compute drift", 10)
// enter -> calibrate
brick.buttonEnter.onEvent(ButtonEvent.Pressed, function () {
sensors.gyro2.calibrate()
})
// right -> compute drift
brick.buttonRight.onEvent(ButtonEvent.Pressed, function () {
sensors.gyro2.computeDrift()
})
// left -> reset
brick.buttonLeft.onEvent(ButtonEvent.Pressed, function () {
sensors.gyro2.reset()
})
```

View File

@@ -9,11 +9,23 @@
"cardType": "tutorial", "cardType": "tutorial",
"url":"/tutorials/calibrate-gyro", "url":"/tutorials/calibrate-gyro",
"imageUrl":"/static/tutorials/calibrate-gyro.png" "imageUrl":"/static/tutorials/calibrate-gyro.png"
}, {
"name": "Turn",
"description": "Use the gyro to turn precisely",
"cardType": "tutorial",
"url":"/tutorials/turn-with-gyro",
"imageUrl":"/static/tutorials/turn-with-gyro.png"
}, { }, {
"name": "Move Straight", "name": "Move Straight",
"description": "Use the gyro to correct the trajectory of the robot", "description": "Use the gyro to correct the trajectory of the robot",
"cardType": "tutorial", "cardType": "tutorial",
"url":"/tutorials/move-straight-with-gyro", "url":"/tutorials/move-straight-with-gyro",
"imageUrl":"/static/tutorials/move-straight-with-gyro.png" "imageUrl":"/static/tutorials/move-straight-with-gyro.png"
}, {
"name": "Drifter",
"description": "Explore how the gyro is drifting",
"cardType": "example",
"url":"/tutorials/drifter",
"imageUrl":"/static/tutorials/drifter.png"
}] }]
``` ```

View File

@@ -0,0 +1,43 @@
# Turn With Gyro
## Introduction @fullscreen
Use the gyro to measure how much the robot is turning, regardless if your wheels are slipping.
## Step 1 Calibrate
Add the ``||sensors:calibrate gyro||`` block to make sure your gyro is ready to use.
```blocks
sensors.gyro2.calibrate()
```
## Step 2 Turn
Use motor blocks to make the robot turn. Don't go too fast!
```blocks
sensors.gyro2.calibrate()
motors.largeBC.steer(200, 20)
```
## Step 3 Pause for turn
Use the ``||sensors:pause until rotated||`` block to wait until the desired amount of rotation has occured.
```blocks
sensors.gyro2.calibrate()
motors.largeBC.steer(200, 20)
sensors.gyro2.pauseUntilRotated(90)
```
## Step 4 Stop
Stop the motors!
```blocks
sensors.gyro2.calibrate()
motors.largeBC.steer(200, 20)
sensors.gyro2.pauseUntilRotated(90)
motors.stopAll()
```

View File

@@ -73,13 +73,7 @@ namespace sensors {
} }
setMode(m: ColorSensorMode) { setMode(m: ColorSensorMode) {
if (m == ColorSensorMode.AmbientLightIntensity) { // don't change threshold after initialization
this.thresholdDetector.setLowThreshold(5);
this.thresholdDetector.setHighThreshold(20);
} else {
this.thresholdDetector.setLowThreshold(20);
this.thresholdDetector.setHighThreshold(80);
}
this._setMode(m) this._setMode(m)
} }

View File

@@ -87,7 +87,7 @@ namespace sensors.internal {
this.devType = DAL.DEVICE_TYPE_NONE this.devType = DAL.DEVICE_TYPE_NONE
this.iicid = '' this.iicid = ''
this.sensors = [] this.sensors = []
this.poller = new Poller(50, () => this.query(), (prev, curr) => this.update(prev, curr)); this.poller = new Poller(25, () => this.query(), (prev, curr) => this.update(prev, curr));
} }
poke() { poke() {
@@ -121,7 +121,7 @@ namespace sensors.internal {
powerMM = control.mmap("/dev/lms_power", 2, 0) powerMM = control.mmap("/dev/lms_power", 2, 0)
devPoller = new Poller(500, () => { return hashDevices(); }, devPoller = new Poller(250, () => { return hashDevices(); },
(prev, curr) => { (prev, curr) => {
detectDevices(); detectDevices();
}); });
@@ -814,10 +814,10 @@ namespace sensors {
export class ThresholdDetector { export class ThresholdDetector {
public id: number; public id: number;
public min: number; private min: number;
public max: number; private max: number;
public lowThreshold: number; private lowThreshold: number;
public highThreshold: number; private highThreshold: number;
public level: number; public level: number;
public state: ThresholdState; public state: ThresholdState;

26
libs/core/integrator.ts Normal file
View File

@@ -0,0 +1,26 @@
namespace control {
export class EulerIntegrator {
public value: number;
private t: number;
private v: number;
constructor() {
this.reset();
}
public integrate(derivative: number): void {
let now = control.millis();
let dt = (now -this.t) / 1000.0;
this.value += dt * (this.v + derivative) / 2;
this.t = now;
this.v = derivative;
}
public reset() {
this.value = 0;
this.v = 0;
this.t = control.millis();
}
}
}

View File

@@ -524,6 +524,7 @@ void stopProgram() {
} }
extern "C" void target_reset() { extern "C" void target_reset() {
pthread_mutex_trylock(&execMutex);
stopMotors(); stopMotors();
stopProgram(); stopProgram();
if (lmsPid) if (lmsPid)

View File

@@ -264,8 +264,9 @@ namespace motors {
// allow 500ms for robot to settle // allow 500ms for robot to settle
if (this._brake && this._brakeSettleTime > 0) if (this._brake && this._brakeSettleTime > 0)
pause(this._brakeSettleTime); pause(this._brakeSettleTime);
else else {
pause(1); // give a tiny breather pause(1);
}
} }
protected pauseOnRun(stepsOrTime: number) { protected pauseOnRun(stepsOrTime: number) {
@@ -275,7 +276,6 @@ namespace motors {
// allow robot to settle // allow robot to settle
this.settle(); this.settle();
} else { } else {
// give a breather to the event system in tight loops
pause(1); pause(1);
} }
} }

View File

@@ -25,7 +25,8 @@
"dal.d.ts", "dal.d.ts",
"icons.jres", "icons.jres",
"ns.ts", "ns.ts",
"platform.h" "platform.h",
"integrator.ts"
], ],
"testFiles": [ "testFiles": [
"test.ts" "test.ts"

View File

@@ -0,0 +1,21 @@
# Pause Until Rotated
Pauses the program until the gyro sensors detect that the desired amount of rotation
has been acheived.
```
sensors.gyro2.pauseUntilRotated(90)
```
## Example
This program performs a square turn left, then right.
```blocks
sensors.gyro2.calibrate()
motors.largeBC.steer(200, 10)
sensors.gyro2.pauseUntilRotated(90)
motors.largeBC.steer(-200, 10)
sensors.gyro2.pauseUntilRotated(-90)
motors.largeBC.stop()
```

View File

@@ -7,12 +7,15 @@ const enum GyroSensorMode {
namespace sensors { namespace sensors {
//% fixedInstances //% fixedInstances
export class GyroSensor extends internal.UartSensor { export class GyroSensor extends internal.UartSensor {
private calibrating: boolean; private _calibrating: boolean;
private _drift: number; private _drift: number;
private _angle: control.EulerIntegrator;
constructor(port: number) { constructor(port: number) {
super(port) super(port)
this.calibrating = false; this._calibrating = false;
this._drift = 0; this._drift = 0;
this._angle = new control.EulerIntegrator();
this._setMode(GyroSensorMode.Rate);
this.setMode(GyroSensorMode.Rate); this.setMode(GyroSensorMode.Rate);
} }
@@ -21,13 +24,17 @@ namespace sensors {
} }
_query(): number { _query(): number {
return this.getNumber(NumberFormat.Int16LE, 0); const v = this.getNumber(NumberFormat.Int16LE, 0);
this._angle.integrate(v - this._drift);
return v;
} }
setMode(m: GyroSensorMode) { setMode(m: GyroSensorMode) {
if (m == GyroSensorMode.Rate && this.mode != m) // decrecated
this._drift = 0; }
this._setMode(m)
isCalibrating(): boolean {
return this._calibrating;
} }
/** /**
@@ -40,15 +47,14 @@ namespace sensors {
//% parts="gyroscope" //% parts="gyroscope"
//% blockNamespace=sensors //% blockNamespace=sensors
//% this.fieldEditor="ports" //% this.fieldEditor="ports"
//% weight=64 //% weight=64 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
angle(): number { angle(): number {
this.poke(); this.poke();
if (this.calibrating) if (this._calibrating)
pauseUntil(() => !this.calibrating, 2000); pauseUntil(() => !this._calibrating, 2000);
this.setMode(GyroSensorMode.Angle); return Math.round(this._angle.value);
return this._query();
} }
/** /**
@@ -65,10 +71,8 @@ namespace sensors {
//% group="Gyro Sensor" //% group="Gyro Sensor"
rate(): number { rate(): number {
this.poke(); this.poke();
if (this.calibrating) if (this._calibrating)
pauseUntil(() => !this.calibrating, 2000); pauseUntil(() => !this._calibrating, 2000);
this.setMode(GyroSensorMode.Rate);
return this._query() - this._drift; return this._query() - this._drift;
} }
@@ -85,12 +89,12 @@ namespace sensors {
//% weight=51 blockGap=8 //% weight=51 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
calibrate(): void { calibrate(): void {
if (this.calibrating) return; // already in calibration mode if (this._calibrating) return; // already in calibration mode
const statusLight = brick.statusLight(); // save current status light const statusLight = brick.statusLight(); // save current status light
brick.setStatusLight(StatusLight.Orange); brick.setStatusLight(StatusLight.Orange);
this.calibrating = true; this._calibrating = true;
// may be triggered by a button click, // may be triggered by a button click,
// give time for robot to settle // give time for robot to settle
pause(700); pause(700);
@@ -104,7 +108,8 @@ namespace sensors {
brick.setStatusLight(statusLight); // resture previous light brick.setStatusLight(statusLight); // resture previous light
// and we're done // and we're done
this.calibrating = false; this._angle.reset();
this._calibrating = false;
return; return;
} }
@@ -116,22 +121,22 @@ namespace sensors {
// wait till sensor is live // wait till sensor is live
pauseUntil(() => this.isActive(), 7000); pauseUntil(() => this.isActive(), 7000);
// mode toggling // mode toggling
this.setMode(GyroSensorMode.Rate); this._setMode(GyroSensorMode.Rate);
this.setMode(GyroSensorMode.Angle); this._setMode(GyroSensorMode.Angle);
this._setMode(GyroSensorMode.Rate);
// check sensor is ready // check sensor is ready
if (!this.isActive()) { if (!this.isActive()) {
brick.setStatusLight(StatusLight.RedFlash); // didn't work brick.setStatusLight(StatusLight.RedFlash); // didn't work
pause(2000); pause(2000);
brick.setStatusLight(statusLight); // restore previous light brick.setStatusLight(statusLight); // restore previous light
this.calibrating = false; this._angle.reset();
this._calibrating = false;
return; return;
} }
// switch to rate mode // switch to rate mode
this.computeDriftNoCalibration(); this.computeDriftNoCalibration();
// switch back to the desired mode
this.setMode(this.mode);
// and done // and done
brick.setStatusLight(StatusLight.Green); // success brick.setStatusLight(StatusLight.Green); // success
@@ -139,7 +144,8 @@ namespace sensors {
brick.setStatusLight(statusLight); // resture previous light brick.setStatusLight(statusLight); // resture previous light
// and we're done // and we're done
this.calibrating = false; this._angle.reset();
this._calibrating = false;
} }
/** /**
@@ -154,13 +160,37 @@ namespace sensors {
//% weight=50 blockGap=8 //% weight=50 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
reset(): void { reset(): void {
if (this.calibrating) return; // already in calibration mode if (this._calibrating) return; // already in calibration mode
this._calibrating = true;
const statusLight = brick.statusLight(); // save current status light
brick.setStatusLight(StatusLight.Orange);
this.calibrating = true;
// send a reset command // send a reset command
super.reset(); super.reset();
this._drift = 0;
this._angle.reset();
pauseUntil(() => this.isActive(), 7000);
// check sensor is ready
if (!this.isActive()) {
brick.setStatusLight(StatusLight.RedFlash); // didn't work
pause(2000);
brick.setStatusLight(statusLight); // restore previous light
this._angle.reset();
this._calibrating = false;
return;
}
this._setMode(GyroSensorMode.Rate);
// and done // and done
this.calibrating = false; brick.setStatusLight(StatusLight.Green); // success
pause(1000);
brick.setStatusLight(statusLight); // resture previous light
// and done
this._angle.reset();
this._calibrating = false;
} }
/** /**
@@ -190,15 +220,35 @@ namespace sensors {
//% weight=10 blockGap=8 //% weight=10 blockGap=8
//% group="Gyro Sensor" //% group="Gyro Sensor"
computeDrift() { computeDrift() {
if (this.calibrating) if (this._calibrating)
pauseUntil(() => !this.calibrating, 2000); pauseUntil(() => !this._calibrating, 2000);
pause(1000); // let the robot settle pause(1000); // let the robot settle
this.computeDriftNoCalibration(); this.computeDriftNoCalibration();
} }
/**
* Pauses the program until the gyro detected
* that the angle changed by the desired amount of degrees.
* @param degrees the degrees to turn
*/
//% help=sensors/gyro/pause-until-rotated
//% block="pause until **gyro** %this|rotated %degrees=rotationPicker|degrees"
//% blockId=gyroPauseUntilRotated
//% parts="gyroscope"
//% blockNamespace=sensors
//% this.fieldEditor="ports"
//% degrees.defl=90
//% weight=63
//% group="Gyro Sensor"
pauseUntilRotated(degrees: number, timeOut?: number): void {
let a = this.angle();
const end = a + degrees;
const direction = (end - a) > 0 ? 1 : -1;
pauseUntil(() => (end - this.angle()) * direction <= 0, timeOut);
}
private computeDriftNoCalibration() { private computeDriftNoCalibration() {
// clear drift // clear drift
this.setMode(GyroSensorMode.Rate);
this._drift = 0; this._drift = 0;
const n = 10; const n = 10;
let d = 0; let d = 0;
@@ -207,23 +257,18 @@ namespace sensors {
pause(20); pause(20);
} }
this._drift = d / n; this._drift = d / n;
this._angle.reset();
} }
_info(): string { _info(): string {
if (this.calibrating) if (this._calibrating)
return "cal..."; return "cal...";
switch (this.mode) {
case GyroSensorMode.Angle:
return `${this._query()}>`;
case GyroSensorMode.Rate:
let r = `${this._query()}r`; let r = `${this._query()}r`;
if (this._drift != 0) if (this._drift != 0)
r += `-${this._drift | 0}`; r += `-${this._drift | 0}`;
return r; return r;
} }
return "";
}
} }
//% fixedInstance whenUsed block="2" weight=95 jres=icons.port2 //% fixedInstance whenUsed block="2" weight=95 jres=icons.port2
@@ -237,4 +282,17 @@ namespace sensors {
//% fixedInstance whenUsed block="4" jres=icons.port4 //% fixedInstance whenUsed block="4" jres=icons.port4
export const gyro4: GyroSensor = new GyroSensor(4) export const gyro4: GyroSensor = new GyroSensor(4)
/**
* Get the rotation angle field editor
* @param degrees angle in degrees, eg: 90
*/
//% blockId=rotationPicker block="%degrees"
//% blockHidden=true shim=TD_ID
//% colorSecondary="#FFFFFF"
//% degrees.fieldEditor="numberdropdown" degrees.fieldOptions.decompileLiterals=true
//% degrees.fieldOptions.data='[["30", 30], ["45", 45], ["60", 60], ["90", 90], ["180", 180], ["-30", -30], ["-45", -45], ["-60", -60], ["-90", -90], ["-180", -180]]'
export function __rotationPicker(degrees: number): number {
return degrees;
}
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "pxt-ev3", "name": "pxt-ev3",
"version": "1.2.17", "version": "1.2.22",
"description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode", "description": "LEGO MINDSTORMS EV3 for Microsoft MakeCode",
"private": false, "private": false,
"keywords": [ "keywords": [

View File

@@ -8,7 +8,6 @@ namespace pxsim {
export class GyroSensorNode extends UartSensorNode { export class GyroSensorNode extends UartSensorNode {
id = NodeType.GyroSensor; id = NodeType.GyroSensor;
private angle: number = 0;
private rate: number = 0; private rate: number = 0;
constructor(port: number) { constructor(port: number) {
@@ -19,14 +18,6 @@ namespace pxsim {
return DAL.DEVICE_TYPE_GYRO; return DAL.DEVICE_TYPE_GYRO;
} }
setAngle(angle: number) {
angle = angle | 0;
if (this.angle != angle) {
this.angle = angle;
this.setChangedState();
}
}
setRate(rate: number) { setRate(rate: number) {
rate = rate | 0; rate = rate | 0;
if (this.rate != rate) { if (this.rate != rate) {
@@ -35,9 +26,12 @@ namespace pxsim {
} }
} }
getRate() {
return this.rate;
}
getValue() { getValue() {
return this.mode == GyroSensorMode.Angle ? this.angle : return this.getRate();
this.mode == GyroSensorMode.Rate ? this.rate : 0;
} }
} }
} }

View File

@@ -2,12 +2,11 @@
namespace pxsim.visuals { namespace pxsim.visuals {
const MAX_RATE = 40; const MAX_RATE = 40;
const MAX_ANGLE = 360;
export class RotationSliderControl extends ControlView<GyroSensorNode> { export class RotationSliderControl extends ControlView<GyroSensorNode> {
private group: SVGGElement; private group: SVGGElement;
private slider: SVGGElement; private slider: SVGGElement;
private text: SVGTextElement; private rateText: SVGTextElement;
private static SLIDER_WIDTH = 70; private static SLIDER_WIDTH = 70;
//private static SLIDER_HEIGHT = 78; //private static SLIDER_HEIGHT = 78;
@@ -26,8 +25,8 @@ namespace pxsim.visuals {
pxsim.svg.child(this.slider, "circle", { 'cx': 9, 'cy': 50, 'r': 13, 'style': 'fill: #f12a21' }); pxsim.svg.child(this.slider, "circle", { 'cx': 9, 'cy': 50, 'r': 13, 'style': 'fill: #f12a21' });
pxsim.svg.child(this.slider, "circle", { 'cx': 9, 'cy': 50, 'r': 12.5, 'style': 'fill: none;stroke: #b32e29' }); pxsim.svg.child(this.slider, "circle", { 'cx': 9, 'cy': 50, 'r': 12.5, 'style': 'fill: none;stroke: #b32e29' });
this.text = pxsim.svg.child(this.group, "text", { this.rateText = pxsim.svg.child(this.group, "text", {
'x': RotationSliderControl.SLIDER_WIDTH / 2, 'x': this.getInnerWidth() / 2,
'y': RotationSliderControl.SLIDER_WIDTH * 1.2, 'y': RotationSliderControl.SLIDER_WIDTH * 1.2,
'text-anchor': 'middle', 'dominant-baseline': 'middle', 'text-anchor': 'middle', 'dominant-baseline': 'middle',
'style': 'font-size: 16px', 'style': 'font-size: 16px',
@@ -72,17 +71,10 @@ namespace pxsim.visuals {
return; return;
} }
const node = this.state; const node = this.state;
let percentage = 50; const rate = node.getRate();
if (node.getMode() == GyroSensorMode.Rate) { this.rateText.textContent = `${rate}°/s`
const rate = node.getValue();
this.text.textContent = `${rate}°/s`
// cap rate at 40deg/s // cap rate at 40deg/s
percentage = 50 + Math.sign(rate) * Math.min(MAX_RATE, Math.abs(rate)) / MAX_RATE * 50; const percentage = 50 + Math.sign(rate) * Math.min(MAX_RATE, Math.abs(rate)) / MAX_RATE * 50;
} else { //angle
const angle = node.getValue();
this.text.textContent = `${angle}°`
percentage = 50 + Math.sign(angle) * Math.min(MAX_ANGLE, Math.abs(angle)) / MAX_ANGLE * 50;
}
const x = RotationSliderControl.SLIDER_WIDTH * percentage / 100; const x = RotationSliderControl.SLIDER_WIDTH * percentage / 100;
const y = Math.abs((percentage - 50) / 50) * 10; const y = Math.abs((percentage - 50) / 50) * 10;
this.slider.setAttribute("transform", `translate(${x}, ${y})`); this.slider.setAttribute("transform", `translate(${x}, ${y})`);
@@ -97,11 +89,7 @@ namespace pxsim.visuals {
t = -(t - 0.5) * 2; // [-1,1] t = -(t - 0.5) * 2; // [-1,1]
const state = this.state; const state = this.state;
if (state.getMode() == GyroSensorMode.Rate) {
state.setRate(MAX_RATE * t); state.setRate(MAX_RATE * t);
} else {
state.setAngle(MAX_ANGLE * t)
}
} }
} }

View File

@@ -18,7 +18,7 @@
"Touch Sensor Tutorials": "tutorials/touch-sensor", "Touch Sensor Tutorials": "tutorials/touch-sensor",
"Color Sensor Tutorials": "tutorials/color-sensor", "Color Sensor Tutorials": "tutorials/color-sensor",
"Ultrasonic Sensor Tutorials": "tutorials/ultrasonic-sensor", "Ultrasonic Sensor Tutorials": "tutorials/ultrasonic-sensor",
"Gyro Sensor Tutorials": "tutorials/gyro", "Gyro Tutorials": "tutorials/gyro",
"Infrared Sensor Tutorials": "tutorials/infrared-sensor", "Infrared Sensor Tutorials": "tutorials/infrared-sensor",
"FLL / City Shaper": "tutorials/city-shaper", "FLL / City Shaper": "tutorials/city-shaper",
"Design Engineering": "design-engineering", "Design Engineering": "design-engineering",
@@ -27,6 +27,6 @@
"Videos": "videos" "Videos": "videos"
}, },
"electronManifest": { "electronManifest": {
"latest": "v1.1.20" "latest": "v1.1.22"
} }
} }