easy-scratch/doc/scratch-vm/Scratch3WeDo2Blocks.html

3627 lines
102 KiB
HTML
Raw Normal View History

2025-02-12 12:27:32 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Scratch3WeDo2Blocks - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="-_StackFrame.html">_StackFrame</a><ul class='methods'><li data-type='method'><a href="-_StackFrame.html#.create">create</a></li><li data-type='method'><a href="-_StackFrame.html#.release">release</a></li><li data-type='method'><a href="-_StackFrame.html#reset">reset</a></li><li data-type='method'><a href="-_StackFrame.html#reuse">reuse</a></li></ul></li><li><a href="BLE.html">BLE</a><ul class='methods'><li data-type='method'><a href="BLE.html#connectPeripheral">connectPeripheral</a></li><li data-type='method'><a href="BLE.html#didReceiveCall">didReceiveCall</a></li><li data-type='method'><a href="BLE.html#disconnect">disconnect</a></li><li data-type='method'><a href="BLE.html#handleDisconnectError">handleDisconnectError</a></li><li data-type='method'><a href="BLE.html#isConnected">isConnected</a></li><li data-type='method'><a href="BLE.html#read">read</a></li><li data-type='method'><a href="BLE.html#requestPeripheral">requestPeripheral</a></li><li data-type='method'><a href="BLE.html#startNotifications">startNotifications</a></li><li data-type='method'><a href="BLE.html#write">write</a></li></ul></li><li><a href="BlockCached.html">BlockCached</a></li><li><a href="Blocks.html">Blocks</a><ul class='methods'><li data-type='method'><a href="Blocks.html#_addScript">_addScript</a></li><li data-type='method'><a href="Blocks.html#_deleteScript">_deleteScript</a></li><li data-type='method'><a href="Blocks.html#_getBackdropField">_getBackdropField</a></li><li data-type='method'><a href="Blocks.html#_getBlockParams">_getBlockParams</a></li><li data-type='method'><a href="Blocks.html#_getCostumeField">_getCostumeField</a></li><li data-type='method'><a href="Blocks.html#_getCustomBlockInternal">_getCustomBlockInternal</a></li><li data-type='method'><a href="Blocks.html#_getSoundField">_getSoundField</a></li><li data-type='method'><a href="Blocks.html#_getSpriteField">_getSpriteField</a></li><li data-type='method'><a href="Blocks.html#blocklyListen">blocklyListen</a></li><li data-type='method'><a href="Blocks.html#blockToXML">blockToXML</a></li><li data-type='method'><a href="Blocks.html#changeBlock">changeBlock</a></li><li data-type='method'><a href="Blocks.html#createBlock">createBlock</a></li><li data-type='method'><a href="Blocks.html#deleteBlock">deleteBlock</a></li><li data-type='method'><a href="Blocks.html#emitProjectChanged">emitProjectChanged</a></li><li data-type='method'><a href="Blocks.html#getAllVariableAndListReferences">getAllVariableAndListReferences</a></li><li data-type='method'><a href="Blocks.html#getBlock">getBlock</a></li><li data-type='method'><a href="Blocks.html#getBranch">getBranch</a></li><li data-type='method'><a href="Blocks.html#getFields">getFields</a></li><li data-type='method'><a href="Blocks.html#getInputs">getInputs</a></li><li data-type='method'><a href="Blocks.html#getMutation">getMutation</a></li><li data-type='method'><a href="Blocks.html#getNextBlock">getNextBlock</a></li><li data-type='method'><a href="Blocks.html#getOpcode">getOpcode</a></li><li data-type='method'><a href="Blocks.html#getProcedureDefinition">getProcedureDefinition</a></li><li data-type='method'><a href="Blocks.html#getProcedureParamNamesAndIds">getProcedureParamNamesAndIds</a></li><li data-type='method'><a href="Blocks.html#getProcedureParamNamesIdsAndDefaults">getProcedureParamNamesIdsAndDefaults</a></li><li data-type='method'><a href="Blocks.html#getScripts">getScripts</a></li><li data-type='method'><a href="Blocks.html#getTopLevelScript">getTopLevelScript</a></li><li data-type='method'><a href="Blocks.html#moveBlock">moveBlock</a></li><li data-type='method'><a href="Blocks.html#mutationToXML">mutationToXML</a></li><li data-type='method'><a href="Blocks.html#resetCache">resetCache</a></li><li data-type='method'><a href="Blocks.html#runAllMonitored">runAllMonitored</a></li><li data-type='method'><a href="Blocks.html#toXML">toXML</a></li><li data-type='method'><a href="Blocks.html#updateAssetName">updateAssetName</a></li><li data-type='method'><a href
</nav>
<div id="main">
<h1 class="page-title">Scratch3WeDo2Blocks</h1>
<section>
<header>
<h2>
Scratch3WeDo2Blocks
</h2>
<div class="class-description"><p>Scratch 3.0 blocks to interact with a LEGO WeDo 2.0 peripheral.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Scratch3WeDo2Blocks"><span class="type-signature"></span>new Scratch3WeDo2Blocks<span class="signature">(runtime)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Construct a set of WeDo 2.0 blocks.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>runtime</code></td>
<td class="type">
<span class="param-type"><a href="Runtime.html">Runtime</a></span>
</td>
<td class="description last"><p>the Scratch 3.0 runtime.</p></td>
</tr>
</tbody>
</table>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".EXTENSION_ID"><span class="type-signature">(static) </span>EXTENSION_ID<span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h4 class="name" id=".TILT_THRESHOLD"><span class="type-signature">(static) </span>TILT_THRESHOLD<span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h4 class="name" id="runtime"><span class="type-signature"></span>runtime<span class="type-signature"> :<a href="Runtime.html">Runtime</a></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>The Scratch 3.0 runtime.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="Runtime.html">Runtime</a></span>
</li>
</ul>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="_forEachMotor"><span class="type-signature">(private) </span>_forEachMotor<span class="signature">(motorID, callback)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Call a callback for each motor indexed by the provided motor ID.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>motorID</code></td>
<td class="type">
<span class="param-type">MotorID</span>
</td>
<td class="description last"><p>the ID specifier.</p></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>the function to call with the numeric motor index for each motor.</p></td>
</tr>
</tbody>
</table>
<h4 class="name" id="_getTiltAngle"><span class="type-signature">(private) </span>_getTiltAngle<span class="signature">(direction)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>direction</code></td>
<td class="type">
<span class="param-type">TiltDirection</span>
</td>
<td class="description last"><p>the direction (up, down, left, right) to check.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>the tilt sensor's angle in the specified direction.
Note that getTiltAngle(up) = -getTiltAngle(down) and getTiltAngle(left) = -getTiltAngle(right).</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="_isTilted"><span class="type-signature">(private) </span>_isTilted<span class="signature">(direction)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<dl class="details">
</dl>
<div class="description">
<p>Test whether the tilt sensor is currently tilted.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>direction</code></td>
<td class="type">
<span class="param-type">TiltDirection</span>
</td>
<td class="description last"><p>the tilt direction to test (up, down, left, right, or any).</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>true if the tilt sensor is tilted past a threshold in the specified direction.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="_noteToTone"><span class="type-signature">(private) </span>_noteToTone<span class="signature">(midiNote)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>midiNote</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the MIDI note value to convert.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>the frequency, in Hz, corresponding to that MIDI note value.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getDistance"><span class="type-signature"></span>getDistance<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>the distance sensor's value, scaled to the [0,100] range.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="getInfo"><span class="type-signature"></span>getInfo<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
<dl class="details">
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>metadata for this extension and its blocks.</p>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">object</span>
</dd>
</dl>
<h4 class="name" id="getTiltAngle"><span class="type-signature"></span>getTiltAngle<span class="signature">(args)</span><span class="type-signature"> &rarr; {number}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>TILT_DIRECTION</code></td>
<td class="type">
<span class="param-type">TiltDirection</span>
</td>
<td class="description last"><p>the direction (up, down, left, right) to check.</p></td>
</tr>
</tbody>
</table>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>the tilt sensor's angle in the specified direction.
Note that getTiltAngle(up) = -getTiltAngle(down) and getTiltAngle(left) = -getTiltAngle(right).</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
<h4 class="name" id="isTilted"><span class="type-signature"></span>isTilted<span class="signature">(args)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>TILT_DIRECTION_ANY</code></td>
<td class="type">
<span class="param-type">TiltDirection</span>
</td>
<td class="description last"><p>the tilt direction to test (up, down, left, right, or any).</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Test whether the tilt sensor is currently tilted.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>true if the tilt sensor is tilted past a threshold in the specified direction.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="motorOff"><span class="type-signature"></span>motorOff<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>MOTOR_ID</code></td>
<td class="type">
<span class="param-type">MotorID</span>
</td>
<td class="description last"><p>the motor(s) to deactivate.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Turn specified motor(s) off.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a Promise that resolves after some delay.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="motorOn"><span class="type-signature"></span>motorOn<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>MOTOR_ID</code></td>
<td class="type">
<span class="param-type">MotorID</span>
</td>
<td class="description last"><p>the motor(s) to activate.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Turn specified motor(s) on indefinitely.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a Promise that resolves after some delay.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="motorOnFor"><span class="type-signature"></span>motorOnFor<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>MOTOR_ID</code></td>
<td class="type">
<span class="param-type">MotorID</span>
</td>
<td class="description last"><p>the motor(s) to activate.</p></td>
</tr>
<tr>
<td class="name"><code>DURATION</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>the amount of time to run the motors.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Turn specified motor(s) on for a specified duration.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a promise which will resolve at the end of the duration.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="playNoteFor"><span class="type-signature"></span>playNoteFor<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>NOTE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the MIDI note to play.</p></td>
</tr>
<tr>
<td class="name"><code>DURATION</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the duration of the note, in seconds.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Make the WeDo 2.0 peripheral play a MIDI note for the specified duration.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a promise which will resolve at the end of the duration.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="setLightHue"><span class="type-signature"></span>setLightHue<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>HUE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the hue to set, in the range [0,100].</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Set the LED's hue.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a Promise that resolves after some delay.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="setMotorDirection"><span class="type-signature"></span>setMotorDirection<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>MOTOR_ID</code></td>
<td class="type">
<span class="param-type">MotorID</span>
</td>
<td class="description last"><p>the motor(s) to be affected.</p></td>
</tr>
<tr>
<td class="name"><code>MOTOR_DIRECTION</code></td>
<td class="type">
<span class="param-type">MotorDirection</span>
</td>
<td class="description last"><p>the new direction for the motor(s).</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Set the direction of rotation for specified motor(s).
If the direction is 'reverse' the motor(s) will be reversed individually.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a Promise that resolves after some delay.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="startMotorPower"><span class="type-signature"></span>startMotorPower<span class="signature">(args)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>MOTOR_ID</code></td>
<td class="type">
<span class="param-type">MotorID</span>
</td>
<td class="description last"><p>the motor(s) to be affected.</p></td>
</tr>
<tr>
<td class="name"><code>POWER</code></td>
<td class="type">
<span class="param-type">int</span>
</td>
<td class="description last"><p>the new power level for the motor(s).</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Turn specified motor(s) off.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>a Promise that resolves after some delay.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise</span>
</dd>
</dl>
<h4 class="name" id="whenDistance"><span class="type-signature"></span>whenDistance<span class="signature">(args)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>OP</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the comparison operation: '&lt;' or '&gt;'.</p></td>
</tr>
<tr>
<td class="name"><code>REFERENCE</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>the value to compare against.</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Compare the distance sensor's value to a reference.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>the result of the comparison, or false on error.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="whenTilted"><span class="type-signature"></span>whenTilted<span class="signature">(args)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<dl class="details">
</dl>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>TILT_DIRECTION_ANY</code></td>
<td class="type">
<span class="param-type">TiltDirection</span>
</td>
<td class="description last"><p>the tilt direction to test (up, down, left, right, or any).</p></td>
</tr>
</tbody>
</table>
<div class="description">
<p>Test whether the tilt sensor is currently tilted.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>args</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>the block's arguments.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
<ul>
<li>true if the tilt sensor is tilted past a threshold in the specified direction.</li>
</ul>
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>