<snapdata remixID="10379918"><project name="microbitTestProject" app="Snap! 6, https://snap.berkeley.edu" version="1"><notes></notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAADPElEQVR4Xu3Sv45NYRTG4W934k9CK6hF4gLcw0x7NLpRKNwAFaZUolCcaKhEw25FoUOh4goUOtEoSI6MQiJRTNasnDc7eU591vdmP/lNm81mM/wIhAQmAYbkzf4REKAQogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogICjPIbF6AGogKLDvDWjdvj8osr4/PV92P/4b0opPGawKIDPPjka8evj70fN/9+/duTr8fF9fmxWq1qIq62KrD4AA+0np15Oc5+u/BfuPWpB+Pp9/VWUY0dXmDxAc7zPE7snvvni7+e/jI+7b0bd+/fGdM0HV7DP7cusPgA30wfx69jP8fzS0/G4w+PBLf1hI42uOgA51fz2NndOZqA66jAogOMyhlvERBgC6NHqgICrMq5axEQYAujR6oCAqzKuWsREGALo0eqAgKsyrlrERBgC6NHqgICrMq5axEQYAujR6oCAqzKuWsREGALo0eqAgKsyrlrERBgC6NHqgICrMq5axEQYAujR6oCAqzKuWsREGALo0eqAgKsyrlrERBgC6NHqgICrMq5axEQYAujR6oCAqzKuWsREGALo0eqAgKsyrlrERBgC6NHqgICrMq5axEQYAujR6oCAqzKuWsREGALo0eqAgKsyrlrERBgC6NHqgICrMq5axEQYAujR6oCAqzKuWsREGALo0eqAgKsyrlrERBgC6NHqgICrMq5axH4DRSnArfg0GVjAAAAAElFTkSuQmCC</thumbnail><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="false" hyperops="true" codify="false" inheritance="true" sublistIDs="false" scheduled="false" id="1"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAOhUlEQVR4Xu3VwQkAAAjEMN1/abewn7jAQRC64wgQIECAAIF3gX1fNEiAAAECBAiMAHsCAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQIHLFxAWmhEwHPAAAAAElFTkSuQmCC</pentrails><costumes><list struct="atomic" id="2"></list></costumes><sounds><list struct="atomic" id="3"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites><sprite name="Sprite" idx="1" x="-69" y="-53" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="190.02599999999998,0,206.55,1" pen="tip" id="8"><costumes><list struct="atomic" id="9"></list></costumes><sounds><list struct="atomic" id="10"></list></sounds><blocks></blocks><variables></variables><scripts><script x="36" y="192.00000000000003"><block s="doWait"><l>1</l></block><block s="doForever"><script><custom-block s="set LED on digital pin %s to %s"><l>1</l><l>1</l></custom-block><block s="doWait"><l>1</l></block><custom-block s="set LED on digital pin %s to %s"><l>1</l><l>0</l></custom-block><block s="doWait"><l>1</l></block></script></block></script><script x="31" y="358"><block s="receiveGo"></block><block s="doForever"><script><block s="doIfElse"><block s="reportEquals"><block var="switch state"/><l>1</l></block><script><custom-block s="set LED on digital pin %s to %s"><l>1</l><l>1</l></custom-block></script><script><custom-block s="set LED on digital pin %s to %s"><l>1</l><l>0</l></custom-block></script></block></script></block></script><script x="270" y="353"><block s="receiveGo"></block><block s="doForever"><script><block s="doIfElse"><block s="reportEquals"><block var="switch state"/><l>0</l></block><script><custom-block s="set LED on digital pin %s to %s"><l>2</l><l>1</l></custom-block></script><script><custom-block s="set LED on digital pin %s to %s"><l>2</l><l>0</l></custom-block></script></block></script></block></script><script x="271" y="202.00000000000003"><block s="receiveGo"></block><block s="doWait"><l>1</l></block><block s="doForever"><script><block s="doSetVar"><l>switch state</l><custom-block s="read %s sensor on digital pin %s"><l>Momentary Switch</l><l>0</l></custom-block></block><block s="bubble"><block var="switch state"/></block></script></block></script><script x="31" y="127"><block s="receiveGo"></block></script><script x="674" y="65.00000000000003"><block s="receiveKey"><l><option>space</option></l><comment w="90" collapsed="false">This is Lab 5r. I couldn&apos;t find the hummingbird version</comment></block><block s="doForever"><script><block s="doPlayNote"><l>70</l><l>0.5</l></block><block s="doPlayNote"><l>80</l><l>0.5</l></block></script></block></script></scripts></sprite><watcher var="pulseWidthus" style="normal" x="15" y="39.000001999999995" color="243,118,29" hidden="true"/><watcher var="delay" style="normal" x="106" y="272.000002" color="243,118,29" hidden="true"/><watcher var="servoAngleDegrees" style="normal" x="114" y="204.000002" color="243,118,29" hidden="true"/><watcher var="turnLevel" style="normal" x="116" y="117" color="243,118,29" hidden="true"/><watcher var="rotationSpeed" style="normal" x="10" y="10" color="243,118,29" hidden="true"/><watcher var="distance" style="normal" x="10" y="31.000001999999995" color="243,118,29" hidden="true"/><watcher var="switch state" style="normal" x="10" y="52.000004000000004" color="243,118,29" hidden="true"/></sprites></stage><hidden></hidden><headers></headers><code></code><blocks><block-definition s="set digital pin %&apos;pin_num&apos; to %&apos;level&apos;" type="command" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input><input type="%s" readonly="true">0<options>0&#xD;1</options></input></inputs><script><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/out/dwritepin/</l><block var="pin_num"/><l>/</l><block var="level"/></list></block></block></block></script></block-definition><block-definition s="read digital pin %&apos;pin_num&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%txt" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>pin</l></list><l>var numCalls = 100;&#xD;var callNum = 0;&#xD;function readdigitalgpin (pin, callNum) {&#xD;    var request = new XMLHttpRequest();&#xD;    var ledURL = "http://127.0.0.1:30063/microbit/in/dreadpin/" + pin;&#xD;    request.open(&apos;GET&apos;, ledURL, false);  // `false` makes the request synchronous&#xD;    request.send(null);&#xD;    callNum++;&#xD;&#xD;    if (request.status === 200) {&#xD;      console.log(request.responseText);&#xD;      if ((request.responseText == -1) &amp;&amp; (callNum &lt; numCalls))&#xD;         readdigitalgpin(pin, callNum);&#xD;      else&#xD;         return request.responseText;&#xD;    } else&#xD;        return "timeout error";&#xD;}&#xD;&#xD;return readdigitalgpin(pin, callNum);</l></block><list><block var="pin_num"/></list></block></block></script><scripts><script x="570" y="108.83333333333331"><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/in/dreadpin/</l><block var="pin_num"/></list></block></block></block></script></scripts></block-definition><block-definition s="set analog pin %&apos;pin_num&apos; to %&apos;level&apos; %" type="command" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input><input type="%n">0</input></inputs><script><block s="doIf"><block s="reportGreaterThan"><block var="level"/><l>100</l></block><script><block s="doSetVar"><l>level</l><l>100</l></block><block s="doIf"><block s="reportLessThan"><block var="level"/><l>0</l></block><script><block s="doSetVar"><l>level</l><l>0</l></block></script></block></script></block><block s="doSetVar"><l>level</l><block s="reportProduct"><block var="level"/><l>10.23</l></block></block><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/out/awritepin/</l><block var="pin_num"/><l>/</l><block var="level"/></list></block></block></block></script></block-definition><block-definition s="read analog pin %&apos;pin_num&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>pin</l></list><l>var numCalls = 100;&#xD;var callNum = 0;&#xD;function readanalogpin (pin, callNum) {&#xD;var request = new XMLHttpRequest();&#xD;var ledURL = "http://127.0.0.1:30063/microbit/in/areadpin/" + pin;&#xD;request.open(&apos;GET&apos;, ledURL, false);  // `false` makes the request synchronous&#xD;request.send(null);&#xD;callNum++;&#xD;&#xD;if (request.status === 200) {&#xD;  console.log(request.responseText);&#xD;  if ((request.responseText == -1) &amp;&amp; (callNum &lt; numCalls))&#xD;     readanalogpin(pin, callNum);&#xD;  else&#xD;     return request.responseText;&#xD;} else&#xD;    return "timeout error";&#xD;}&#xD;&#xD;return readanalogpin(pin, callNum);&#xD;</l></block><list><block var="pin_num"/></list></block></block></script><scripts><script x="546.9951171875" y="86.83333333333331"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/in/areadpin/</l><block var="pin_num"/></list></block></block></script></scripts></block-definition><block-definition s="set analog pulse pin %&apos;pin_num&apos; to %&apos;level&apos; µs" type="command" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input><input type="%n">0</input></inputs><script><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/out/writeanalogpulse/</l><block var="pin_num"/><l>/</l><block var="level"/></list></block></block></block></script></block-definition><block-definition s="micro:bit Display $nl %&apos;r1c1&apos; %&apos;r1c2&apos; %&apos;r1c3&apos; %&apos;r1c4&apos; %&apos;r1c5&apos; $nl %&apos;r2c1&apos; %&apos;r2c2&apos; %&apos;r2c3&apos; %&apos;r2c4&apos; %&apos;r2c5&apos; $nl %&apos;r3c1&apos; %&apos;r3c2&apos; %&apos;r3c3&apos; %&apos;r3c4&apos; %&apos;r3c5&apos; $nl %&apos;r4c1&apos; %&apos;r4c2&apos; %&apos;r4c3&apos; %&apos;r4c4&apos; %&apos;r4c5&apos; $nl %&apos;r5c1&apos; %&apos;r5c2&apos; %&apos;r5c3&apos; %&apos;r5c4&apos; %&apos;r5c5&apos;" type="command" category="looks"><header></header><code></code><translations>ko:micro:bit 보이기 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;de:micro:bit LED Anzeige _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;pt:micro:bit Visor _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;fr:micro:bit Display _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;nl:micro:bit Scherm _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;zh_CN:micro:bit 显示 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;zh_TW:micro:bit 顯示 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;ar:micro:bit عرض _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;dk:micro:bit Display _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;he:micro:bit מסך _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;es:micro:bit Monitor _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;ca:micro:bit Pantalla _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;fi:micro:bit Näytä _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;sv:micro:bit Skärm _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _&#xD;</translations><inputs><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input><input type="%b">false</input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>r1c1, r1c2, r1c3, r1c4, r1c5, r2c1, r2c2, r2c3, r2c4, r2c5, r3c1, r3c2, r3c3, r3c4, r3c5, r4c1, r4c2, r4c3, r4c4, r4c5, r5c1, r5c2, r5c3, r5c4, r5c5 </l></list><l>////////////////////////////////////////////////////////////////////////////////&#xD;// In order to avoid sending more messages than the app can handle, whenever we&#xD;// send a message we also save it in a persistent global variable. When the&#xD;// message is processed in the app, the callback checks if the global variable&#xD;// still matches what it was changed to. If it was, it deletes the global&#xD;// variable. Otherwise the message is resent with new data.&#xD;//&#xD;// When this block is called it checks if the global value has been set. If it&#xD;// has, it sends a message. Otherwise it just updates the value and lets the&#xD;// callback handle it.&#xD;&#xD;// Create url representation from inputs&#xD;var symbolString =  r1c1 + "\/"+ r1c2 + "\/"+ r1c3 + "\/"+ r1c4 + "\/"+ r1c5 + "\/" +&#xD;                    r2c1 + "\/"+ r2c2 + "\/"+ r2c3 + "\/"+ r2c4 + "\/"+ r2c5 + "\/" +&#xD;                    r3c1 + "\/"+ r3c2 + "\/"+ r3c3 + "\/"+ r3c4 + "\/"+ r3c5 + "\/" +&#xD;                    r4c1 + "\/"+ r4c2 + "\/"+ r4c3 + "\/"+ r4c4 + "\/"+ r4c5 + "\/" +&#xD;                    r5c1 + "\/"+ r5c2 + "\/"+ r5c3 + "\/"+ r5c4 + "\/"+ r5c5 ;&#xD;&#xD;//r1c1, r1c2, r1c3, r1c4, r1c5, r2c1, r2c2, r2c3, r2c4, r2c5, r3c1, r3c2, r3c3, r3c4, r3c5, r4c1, r4c2, r4c3, r4c4, r4c5, r5c1, r5c2, r5c3, r5c4, r5c5 &#xD;&#xD;// We can&apos;t run code beforehand to define values so we must check each block&#xD;// call if they are set.&#xD;if (window.birdbrain === undefined || window.birdbrain.symbolObj === undefined) {&#xD;    window.birdbrain = window.birdbrain || {};&#xD;    window.birdbrain.symbolObj = {&#xD;        // By attaching this function to a global variable, it is only&#xD;        // defined once instead of every time this block is called, improving&#xD;        // performance significantly.&#xD;        printSymbol: function(symbol) {&#xD;            function callback() {&#xD;                if (window.birdbrain.symbolObj.symbolToPrint === symbol) {  // Check if arrays are equal&#xD;                    delete window.birdbrain.symbolObj.symbolToPrint;&#xD;                }&#xD;                else {&#xD;                    window.birdbrain.symbolObj.printSymbol(window.birdbrain.symbolObj.symbolToPrint);&#xD;                }&#xD;            }&#xD;&#xD;            //Create a new XMLHttpRequest object&#xD;            var xhr = new XMLHttpRequest();&#xD;            var symbolURL = "http://127.0.0.1:30063/microbit/out/leddisplay/" + symbol;&#xD;            xhr.open("GET", symbolURL, true);&#xD;            xhr.onload = function (e) {&#xD;              if (xhr.readyState === 4) {&#xD;                if (xhr.status === 200) {&#xD;                  callback();&#xD;                } else {&#xD;                  console.error(xhr.statusText);&#xD;                }&#xD;              }&#xD;            };&#xD;            xhr.onerror = function (e) {&#xD;              console.error(xhr.statusText);&#xD;            };&#xD;            xhr.send(null);&#xD;&#xD;        }&#xD;    }&#xD;}&#xD;&#xD;if (window.birdbrain.symbolObj.symbolToPrint === undefined) {&#xD;  window.birdbrain.symbolObj.printSymbol(symbolString);&#xD;}&#xD;&#xD;window.birdbrain.symbolObj.symbolToPrint = symbolString;&#xD;&#xD;&#xD;</l></block><list><block var="r1c1"/><block var="r1c2"/><block var="r1c3"/><block var="r1c4"/><block var="r1c5"/><block var="r2c1"/><block var="r2c2"/><block var="r2c3"/><block var="r2c4"/><block var="r2c5"/><block var="r3c1"/><block var="r3c2"/><block var="r3c3"/><block var="r3c4"/><block var="r3c5"/><block var="r4c1"/><block var="r4c2"/><block var="r4c3"/><block var="r4c4"/><block var="r4c5"/><block var="r5c1"/><block var="r5c2"/><block var="r5c3"/><block var="r5c4"/><block var="r5c5"/></list></block><block s="doWait"><l>0.01</l></block></script><scripts><script x="731" y="16"><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30061/hummingbird/out/symbol/A/</l><block var="11"/><l>/</l><block var="12"/><l>/</l><block var="r1c3"/><l>/</l><block var="r1c4"/><l>/</l><block var="r1c5"/><l>/</l><block var="r2c1"/><l>/</l><block var="r2c2"/><l>/</l><block var="r2c3"/><l>/</l><block var="r2c4"/><l>/</l><block var="25"/><l>/</l><block var="31"/><l>/</l><block var="r3c2"/><l>/</l><block var="33"/><l>/</l><block var="34"/><l>/</l><block var="35"/><l>/</l><block var="41"/><l>/</l><block var="42"/><l>/</l><block var="43"/><l>/</l><block var="44"/><l>/</l><block var="45"/><l>/</l><block var="51"/><l>/</l><block var="52"/><l>/</l><block var="53"/><l>/</l><block var="54"/><l>/</l><block var="55"/></list></block></block></block></script></scripts></block-definition><block-definition s="micro:bit display %&apos;state&apos;" type="command" category="looks"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">disable<options>disable&#xD;enable</options></input></inputs><script><block s="doIfElse"><block s="reportEquals"><block var="state"/><l>enable</l></block><script><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/out/microbitdisplay/</l><l>17</l><l>/</l><l>1</l></list></block></block></block></script><script><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/out/microbitdisplay/</l><l>17</l><l>/</l><l>0</l></list></block></block></block></script></block><block s="doWait"><l>0.01</l></block></script></block-definition><block-definition s="read %&apos;sensor&apos; sensor on analog pin %&apos;pin&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%txt" readonly="true">Light (%)<options>Rotary (%)&#xD;Light (%)&#xD;Moisture (%)&#xD;Sound (%)&#xD;Temperature (C)&#xD;Other (V)</options></input><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input></inputs><script><block s="doDeclareVariables"><list><l>value</l></list></block><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Other (V)</l></block><script><block s="doSetVar"><l>sensor</l><l>Other</l></block></script></block><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Distance (cm)</l></block><script><block s="doSetVar"><l>sensor</l><l>Distance</l></block></script></block><block s="doSetVar"><l>value</l><custom-block s="read analog pin %s"><block var="pin"/></custom-block></block><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Other</l></block><script><block s="doReport"><block s="reportQuotient"><block s="reportRound"><block s="reportProduct"><block s="reportProduct"><l>0.003225806</l><block var="value"/></block><l>100</l></block></block><l>100</l><comment w="102" collapsed="false">3.3/1023 scale factor</comment></block></block></script></block><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Sound (%)</l><comment w="155" collapsed="true">If connected, adjust sound level</comment></block><script><block s="doReport"><block s="reportRound"><block s="reportProduct"><l>0.1955</l><block var="value"/><comment w="140" collapsed="false">200/1023 Scaling factor</comment></block></block></block></script></block><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Light (%)</l></block><script><block s="doReport"><block s="reportRound"><block s="reportProduct"><l>0.392</l><block var="value"/><comment w="140" collapsed="false">TODO: Digital Light Sensor  i.e. On or Off</comment></block></block></block></script></block><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Rotary (%)</l></block><script><block s="doReport"><block s="reportRound"><block s="reportProduct"><l>0.09775</l><block var="value"/><comment w="140" collapsed="false">100/1023 Scaling factor</comment></block></block></block></script></block></script><scripts><script x="251" y="586.1666666666667"><block s="doIfElse"><block s="reportNot"><block s="reportEquals"><block var="value"/><l>Not Connected</l></block></block><script></script><script><block s="doReport"><l>Not Connected</l></block></script></block></script><script x="356.4560546875" y="198.33333333333331"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/in/areadpin/</l><block var="pin"/></list></block></block></script><script x="471" y="244.16666666666669"><block s="doIf"><block s="reportEquals"><block var="sensor"/><l>Distance</l></block><script><block s="doReport"><block s="reportRound"><block s="reportProduct"><l>1.17</l><block var="value"/></block></block><comment w="90" collapsed="false">117/100 Scaling factor</comment></block></script></block></script></scripts></block-definition><block-definition s="micro:bit Accelerometer (m/s²) %&apos;dim&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%txt" readonly="true">X<options>X&#xD;Y&#xD;Z</options></input></inputs><script><block s="doReport"><block s="reportProduct"><block s="reportRound"><block s="reportQuotient"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/in/</l><l>accelerometer</l><l>/</l><block var="dim"/></list></block></block><l>100</l></block><comment w="229" collapsed="false">milli-g  converted to m/s/s.  e.g. 1g = 9.8 m/s/s</comment></block><l>.98</l></block></block></script></block-definition><block-definition s="micro:bit %&apos;dim&apos;" type="predicate" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%txt" readonly="true">Screen Up<options>Screen Up&#xD;Screen Down&#xD;Tilt Left&#xD;Tilt Right&#xD;Logo Up&#xD;Logo Down&#xD;Shake</options></input></inputs><script><block s="doIfElse"><block s="reportEquals"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/in/orientation/</l><block var="dim"/></list></block></block><l>true</l></block><script><block s="doReport"><block s="reportBoolean"><l><bool>true</bool></l></block></block></script><script><block s="doReport"><block s="reportBoolean"><l><bool>false</bool></l></block></block></script></block></script></block-definition><block-definition s="Position Servo pin %&apos;pin&apos; %&apos;position&apos; °" type="command" category="motion"><header></header><code></code><translations>ko:Hummingbird 위치 제어 서보 _ _ °&#xD;de:Hummingbird Position Servo _ _ °&#xD;pt:Hummingbird Posição do Servo _ _ °&#xD;fr:Hummingbird Position Servo _ _ °&#xD;nl:Hummingbird Positie-Servo _ _ °&#xD;zh_CN:Hummingbird 位置伺服 _ _ °&#xD;zh_TW:Hummingbird 位置伺服 _ _ °&#xD;ar:Hummingbird موقف محرك سيرفو المؤازر  _ _&#xD;dk:Hummingbird Positionsservo _ _ °&#xD;he:Hummingbird סרוו כיוון     _ _&#xD;es:Hummingbird Servo de posicion _ _ °&#xD;ca:Hummingbird Servo posicional _ _ °&#xD;fi:Hummingbird Asentoservo _ _ °&#xD;sv:Hummingbird Positionsservo _ _ °&#xD;</translations><inputs><input type="%n" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input><input type="%n">90</input></inputs><script><block s="doIf"><block s="reportLessThan"><block var="position"/><l>0</l></block><script><block s="doSetVar"><l>position</l><l>0</l></block></script></block><block s="doIf"><block s="reportGreaterThan"><block var="position"/><l>180</l></block><script><block s="doSetVar"><l>position</l><l>180</l></block></script></block><block s="doRun"><block s="reportJSFunction"><list><l>pin</l><l>position</l></list><l>////////////////////////////////////////////////////////////////////////////////&#xD;// In order to avoid sending more messages than the app can handle, whenever we&#xD;// send a message we also save it in a persistent global variable. When the&#xD;// message is processed in the app, the callback checks if the global variable&#xD;// still matches what it was changed to. If it was, it deletes the global&#xD;// variable. Otherwise the message is resent with new data.&#xD;//&#xD;// When this block is called it checks if the global value has been set. If it&#xD;// has, it sends a message. Otherwise it just updates the value and lets the&#xD;// callback handle it.&#xD;&#xD;&#xD;// We can&apos;t run code beforehand to define values so we must check each block&#xD;// call if they are set.&#xD;if (window.birdbrain === undefined || window.birdbrain.servos === undefined) {&#xD;    window.birdbrain = window.birdbrain || {};&#xD;    window.birdbrain.servos = {&#xD;&#xD;&#xD;        // By attaching this function to a global variable, it is only&#xD;        // defined once instead of every time this block is called, improving&#xD;        // performance significantly.&#xD;        setServoAngle: function (pin, angle) {&#xD;&#xD;            &#xD;            function callback() {&#xD;                if (window.birdbrain.servos[pin] === angle) {&#xD;                    delete window.birdbrain.servos[pin];&#xD;                }&#xD;                else {&#xD;                    window.birdbrain.servos.setServoAngle(pin, window.birdbrain.servos[pin]);&#xD;                }&#xD;            }&#xD;&#xD;            //Create a new XMLHttpRequest object&#xD;            var xhr = new XMLHttpRequest();&#xD;            var thisURL = "http://127.0.0.1:30063/microbit/out/writeservo/" + pin + "/" + angle;&#xD;            //console.log("thisURL: " + thisURL);&#xD;            xhr.open("GET", thisURL, true);&#xD;            xhr.onload = function (e) {&#xD;              if (xhr.readyState === 4) {&#xD;                if (xhr.status === 200) {&#xD;                  callback();&#xD;                } else {&#xD;                  console.error(xhr.statusText);&#xD;                }&#xD;              }&#xD;            };&#xD;            xhr.onerror = function (e) {&#xD;              console.error(xhr.statusText);&#xD;            };&#xD;            xhr.send(null);             &#xD;        }&#xD;&#xD;    };&#xD;}&#xD;&#xD;//var realAngle = Math.floor(ang*1.25);&#xD;&#xD;//realAngle = Math.max(Math.min(realAngle,225.0),0.0);&#xD;&#xD;if (window.birdbrain.servos[pin] === undefined) {&#xD;    window.birdbrain.servos.setServoAngle(pin, position);&#xD;}&#xD;&#xD;window.birdbrain.servos[pin] = position;</l></block><list><block var="pin"/><block var="position"/></list></block><block s="doWait"><l>0</l></block></script></block-definition><block-definition s="Rotation Servo pin %&apos;pin&apos; %&apos;speed&apos; %" type="command" category="motion"><header></header><code></code><translations>ko:Hummingbird 회전속도 제어 서보 _ _ %&#xD;de:Hummingbird Drehung Servo _ _ %&#xD;pt:Hummingbird Rotação do Servo _ _ %&#xD;fr:Hummingbird Rotation Servo _ _ %&#xD;nl:Hummingbird Draai-Servo _ _ %&#xD;zh_CN:Hummingbird 旋转伺服 _ _ %&#xD;zh_TW:Hummingbird 旋轉伺服 _ _ %&#xD;ar:Hummingbird فتحة دوران المحرك المؤازر  _ _&#xD;dk:Hummingbird Rotationsservo _ _ %&#xD;he:Hummingbird סרוו סיבובים    _ _ %&#xD;es:Hummingbird Servo de rotacion _ _ %&#xD;ca:Hummingbird Servo rotacional _ _ %&#xD;fi:Hummingbird Kiertoservo _ _ %&#xD;sv:Hummingbird Rotationsservo _ _ %&#xD;</translations><inputs><input type="%n" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input><input type="%n">0</input></inputs><script><block s="doIf"><block s="reportLessThan"><block var="speed"/><l>-100</l></block><script><block s="doSetVar"><l>speed</l><l>-100</l></block></script></block><block s="doIf"><block s="reportGreaterThan"><block var="speed"/><l>100</l></block><script><block s="doSetVar"><l>speed</l><l>100</l></block></script></block><block s="doIfElse"><block s="reportAnd"><block s="reportGreaterThan"><block var="speed"/><l>-3</l></block><block s="reportLessThan"><block var="speed"/><l>3</l></block></block><script><block s="doSetVar"><l>speed</l><l>0</l></block></script><script><block s="doIfElse"><block s="reportGreaterThan"><block var="speed"/><l>0</l></block><script><block s="doSetVar"><l>speed</l><block s="reportMonadic"><l><option>abs</option></l><block s="reportDifference"><block var="speed"/><l>100</l></block></block></block><block s="doSetVar"><l>speed</l><block s="reportSum"><block s="reportProduct"><block var="speed"/><l>8</l></block><l>700</l></block></block></script><script><block s="doSetVar"><l>speed</l><block s="reportSum"><l>1500</l><block s="reportProduct"><block s="reportMonadic"><l><option>abs</option></l><block var="speed"/></block><l>8</l></block></block></block></script></block></script></block><block s="doRun"><block s="reportJSFunction"><list><l>pin</l><l>speed</l></list><l>/////////////////////////////////////////////////////////////////////////////&#xD;// In order to avoid sending more messages than the app can handle, whenever we&#xD;// send a message we also save it in a persistent global variable. When the&#xD;// message is processed in the app, the callback checks if the global variable&#xD;// still matches what it was changed to. If it was, it deletes the global&#xD;// variable. Otherwise the message is resent with new data.&#xD;//&#xD;// When this block is called it checks if the global value has been set. If it&#xD;// has, it sends a message. Otherwise it just updates the value and lets the&#xD;// callback handle it.&#xD;&#xD;&#xD;// We can&apos;t run code beforehand to define values so we must check each block&#xD;// call if they are set.&#xD;if (window.birdbrain === undefined || window.birdbrain.rotationServos === undefined) {&#xD;    window.birdbrain = window.birdbrain || {};&#xD;    window.birdbrain.rotationServos = {&#xD;        // By attaching this function to a global variable, it is only&#xD;        // defined once instead of every time this block is called, improving&#xD;        // performance significantly.&#xD;        setServoSpeed: function (pin, speed) {&#xD;            function callback() {&#xD;                if (window.birdbrain.rotationServos[pin] === speed) {&#xD;                    delete window.birdbrain.rotationServos[pin];&#xD;                }&#xD;                else {&#xD;                    window.birdbrain.rotationServos.setServoSpeed(pin, window.birdbrain.rotationServos[pin]);&#xD;                }&#xD;            }&#xD;&#xD;            //Create a new XMLHttpRequest object&#xD;            var xhr = new XMLHttpRequest();&#xD;            var thisURL = "http://127.0.0.1:30063/microbit/out/writeservopulse/" + pin + "/" + speed;&#xD;            console.log("thisURL: " + thisURL);&#xD;            xhr.open("GET", thisURL, true);&#xD;            xhr.onload = function (e) {&#xD;              if (xhr.readyState === 4) {&#xD;                if (xhr.status === 200) {&#xD;                  callback();&#xD;                } else {&#xD;                  console.error(xhr.statusText);&#xD;                }&#xD;              }&#xD;            };&#xD;            xhr.onerror = function (e) {&#xD;              console.error(xhr.statusText);&#xD;            };&#xD;            xhr.send(null);          &#xD;            &#xD;        }&#xD;    };&#xD;}&#xD;&#xD;if (window.birdbrain.rotationServos[pin] === undefined) {&#xD;    window.birdbrain.rotationServos.setServoSpeed(pin, speed);&#xD;}&#xD;&#xD;window.birdbrain.rotationServos[pin] = speed;</l></block><list><block var="pin"/><block var="speed"/></list></block></script></block-definition><block-definition s="set LED on analog pin %&apos;pin&apos; to %&apos;intensity&apos; %" type="command" category="looks"><header></header><code></code><translations>ko:Hummingbird LED _ _ %&#xD;de:Hummingbird LED _ _ %&#xD;pt:Hummingbird LED _ _ %&#xD;fr:Hummingbird LED _ _ %&#xD;nl:Hummingbird LED _ _ %&#xD;zh_CN:Hummingbird LED _ _ %&#xD;zh_TW:Hummingbird LED _ _ %&#xD;ar:Hummingbird ضوء _ _&#xD;dk:Hummingbird LED _ _ %&#xD;he:Hummingbird לד   % _ _&#xD;es:Hummingbird LED _ _ %&#xD;ca:Hummingbird LED _ _ %&#xD;fi:Hummingbird LED _ _ %&#xD;sv:Hummingbird LED _ _ %&#xD;</translations><inputs><input type="%n" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input><input type="%n">0</input></inputs><script><block s="doIf"><block s="reportLessThan"><block var="intensity"/><l>0</l></block><script><block s="doSetVar"><l>intensity</l><l>0</l></block></script></block><block s="doIf"><block s="reportGreaterThan"><block var="intensity"/><l>100</l></block><script><block s="doSetVar"><l>intensity</l><l>100</l></block></script></block><block s="doSetVar"><l>intensity</l><block s="reportRound"><block s="reportProduct"><block var="intensity"/><l>10.23</l></block><comment w="158" collapsed="false">Scale factor  to 0 - 1023 range</comment></block></block><block s="doRun"><block s="reportJSFunction"><list><l>pin,intensitynum</l></list><l>////////////////////////////////////////////////////////////////////////////////&#xD;// In order to avoid sending more messages than the app can handle, whenever we&#xD;// send a message we also save it in a persistent global variable. When the&#xD;// message is processed in the app, the callback checks if the global variable&#xD;// still matches what it was changed to. If it was, it deletes the global&#xD;// variable. Otherwise the message is resent with new data.&#xD;//&#xD;// When this block is called it checks if the global value has been set. If it&#xD;// has, it sends a message. Otherwise it just updates the value and lets the&#xD;// callback handle it.&#xD;&#xD;&#xD;// We can&apos;t run code beforehand to define values so we must check each block&#xD;// call if they are set.&#xD;if (window.birdbrain === undefined || window.birdbrain.LEDs === undefined) {&#xD;    window.birdbrain = window.birdbrain || {};&#xD;    window.birdbrain.LEDs = {&#xD;        // By attaching this function to a global variable, it is only&#xD;        // defined once instead of every time this block is called, improving&#xD;        // performance significantly.&#xD;        setLEDIntensity: function(pin, intensity) {&#xD;            function callback() {&#xD;                if (window.birdbrain.LEDs[pin] === intensity) {&#xD;                    delete window.birdbrain.LEDs[pin];&#xD;                }&#xD;                else {&#xD;                    window.birdbrain.LEDs.setLEDIntensity(pin, window.birdbrain.LEDs[pin]);&#xD;                }&#xD;            }&#xD;&#xD;            //Create a new XMLHttpRequest object&#xD;            var xhr = new XMLHttpRequest();&#xD;            var ledURL = "http://127.0.0.1:30063/microbit/out/awritepin/" + pin + "/" + intensity;&#xD;            //console.log(ledURL);&#xD;            xhr.open("GET", ledURL, true);&#xD;            xhr.onload = function (e) {&#xD;              if (xhr.readyState === 4) {&#xD;                if (xhr.status === 200) {&#xD;                  callback();&#xD;                } else {&#xD;                  console.error(xhr.statusText);&#xD;                }&#xD;              }&#xD;            };&#xD;            xhr.onerror = function (e) {&#xD;              console.error(xhr.statusText);&#xD;            };&#xD;            xhr.send(null);&#xD;&#xD;        }&#xD;    }&#xD;}&#xD;&#xD;//var realIntensity = Math.floor(intensitynum*10.23);&#xD;&#xD;//realIntensity = Math.max(Math.min(realIntensity,1023.0),0.0);&#xD;&#xD;if (window.birdbrain.LEDs[pin] === undefined) {&#xD;  window.birdbrain.LEDs.setLEDIntensity(pin, intensitynum);&#xD;}&#xD;&#xD;window.birdbrain.LEDs[pin] = intensitynum;</l></block><list><block var="pin"/><block var="intensity"/></list></block><block s="doWait"><l>0</l></block></script><scripts><script x="484.42857142857156" y="35.5714285714285"><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30061/hummingbird/out/led/</l><block var="port"/><l>/</l><block var="intensity"/></list></block></block></block></script></scripts></block-definition><block-definition s="set LED on digital pin %&apos;pin&apos; to %&apos;intensity&apos;" type="command" category="looks"><header></header><code></code><translations>ko:Hummingbird LED _ _ %&#xD;de:Hummingbird LED _ _ %&#xD;pt:Hummingbird LED _ _ %&#xD;fr:Hummingbird LED _ _ %&#xD;nl:Hummingbird LED _ _ %&#xD;zh_CN:Hummingbird LED _ _ %&#xD;zh_TW:Hummingbird LED _ _ %&#xD;ar:Hummingbird ضوء _ _&#xD;dk:Hummingbird LED _ _ %&#xD;he:Hummingbird לד   % _ _&#xD;es:Hummingbird LED _ _ %&#xD;ca:Hummingbird LED _ _ %&#xD;fi:Hummingbird LED _ _ %&#xD;sv:Hummingbird LED _ _ %&#xD;</translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input><input type="%s" readonly="true">0<options>0&#xD;1</options></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>pin,intensitynum</l></list><l>////////////////////////////////////////////////////////////////////////////////&#xD;// In order to avoid sending more messages than the app can handle, whenever we&#xD;// send a message we also save it in a persistent global variable. When the&#xD;// message is processed in the app, the callback checks if the global variable&#xD;// still matches what it was changed to. If it was, it deletes the global&#xD;// variable. Otherwise the message is resent with new data.&#xD;//&#xD;// When this block is called it checks if the global value has been set. If it&#xD;// has, it sends a message. Otherwise it just updates the value and lets the&#xD;// callback handle it.&#xD;&#xD;&#xD;// We can&apos;t run code beforehand to define values so we must check each block&#xD;// call if they are set.&#xD;if (window.birdbrain === undefined || window.birdbrain.LEDs === undefined) {&#xD;    window.birdbrain = window.birdbrain || {};&#xD;    window.birdbrain.LEDs = {&#xD;        // By attaching this function to a global variable, it is only&#xD;        // defined once instead of every time this block is called, improving&#xD;        // performance significantly.&#xD;        setLEDIntensity: function(pin, intensity) {&#xD;            function callback() {&#xD;                if (window.birdbrain.LEDs[pin] === intensity) {&#xD;                    delete window.birdbrain.LEDs[pin];&#xD;                }&#xD;                else {&#xD;                    window.birdbrain.LEDs.setLEDIntensity(pin, window.birdbrain.LEDs[pin]);&#xD;                }&#xD;            }&#xD;&#xD;            //Create a new XMLHttpRequest object&#xD;            var xhr = new XMLHttpRequest();&#xD;            var ledURL = "http://127.0.0.1:30063/microbit/out/dwritepin/" + pin + "/" + intensity;&#xD;            //console.log(ledURL);            &#xD;            xhr.open("GET", ledURL, true);&#xD;            xhr.onload = function (e) {&#xD;              if (xhr.readyState === 4) {&#xD;                if (xhr.status === 200) {&#xD;                  callback();&#xD;                } else {&#xD;                  console.error(xhr.statusText);&#xD;                }&#xD;              }&#xD;            };&#xD;            xhr.onerror = function (e) {&#xD;              console.error(xhr.statusText);&#xD;            };&#xD;            xhr.send(null);&#xD;&#xD;        }&#xD;    }&#xD;}&#xD;&#xD;//var realIntensity = Math.floor(intensitynum*10.23);&#xD;&#xD;//realIntensity = Math.max(Math.min(realIntensity,1023.0),0.0);&#xD;&#xD;if (window.birdbrain.LEDs[pin] === undefined) {&#xD;  window.birdbrain.LEDs.setLEDIntensity(pin, intensitynum);&#xD;}&#xD;&#xD;window.birdbrain.LEDs[pin] = intensitynum;</l></block><list><block var="pin"/><block var="intensity"/></list></block><block s="doWait"><l>0</l></block></script><scripts><script x="580.4285714285716" y="95.28571428571445"><block s="doSetVar"><l>intensity</l><block s="reportRound"><block s="reportProduct"><block var="intensity"/><l>2.55</l><comment w="90" collapsed="false">Scale factor 255/100</comment></block></block></block></script><script x="659" y="198.53333333333342"><block s="reportEquals"><l></l><l></l></block></script><script x="823" y="317.8333333333332"><block s="doIfElse"><l/><script></script><script></script></block></script><script x="707" y="174.66666666666669"><block s="doIf"><block s="reportOr"><block s="reportGreaterThan"><block var="intensity"/><l>0</l></block><block s="reportEquals"><block var="intensity"/><l>on</l></block></block><script><block s="doSetVar"><l>intensity</l><l>1</l></block></script></block><block s="doIf"><block s="reportOr"><block s="reportGreaterThan"><l>1</l><block var="intensity"/></block><block s="reportEquals"><block var="intensity"/><l>off</l></block></block><script><block s="doSetVar"><l>intensity</l><l>0</l></block></script></block></script><script x="610" y="251.83333333333331"><block s="bubble"><block var="intensity"/></block></script><script x="736.4285714285716" y="37.571428571428555"><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30061/hummingbird/out/led/</l><block var="port"/><l>/</l><block var="intensity"/></list></block></block></block></script><script x="926" y="366.8333333333333"><block s="doIfElse"><block s="reportEquals"><block var="intensity"/><l>on</l></block><script><block s="doSetVar"><l>intensity</l><l>1</l></block></script><script><block s="doIfElse"><block s="reportEquals"><block var="intensity"/><l>off</l></block><script><block s="doSetVar"><l>intensity</l><l>0</l></block></script><script><block s="doIfElse"><block s="reportGreaterThan"><block var="intensity"/><l>0</l></block><script><block s="doSetVar"><l>intensity</l><l>1</l></block></script><script><block s="doSetVar"><l>intensity</l><l>0</l></block></script></block></script></block></script></block></script></scripts></block-definition><block-definition s="read %&apos;sensor&apos; sensor on digital pin %&apos;pin&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">Light<options>Light&#xD;On/Off&#xD;Momentary Switch&#xD;Opto-interrupt&#xD;Water</options></input><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input></inputs><script><block s="doReport"><custom-block s="read digital pin %txt"><block var="pin"/></custom-block></block></script><scripts><script x="158.9951171875" y="101.83333333333331"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/in/dreadpin/</l><block var="pin"/></list></block></block></script></scripts></block-definition><block-definition s="read analog period on pin %&apos;pin_num&apos; µs" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;10</options></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>pin</l></list><l>var numCalls = 100;&#xD;var callNum = 0;&#xD;function readanalogpulsepin (pin, callNum) {&#xD;var request = new XMLHttpRequest();&#xD;var ledURL = "http://127.0.0.1:30063/microbit/in/areadpulsepin/" + pin;&#xD;request.open(&apos;GET&apos;, ledURL, false);  // `false` makes the request synchronous&#xD;request.send(null);&#xD;&#xD;&#xD;//console.log(callNum);&#xD;callNum++;&#xD;if (request.status === 200) {&#xD;  //console.log(request.responseText);&#xD;  if ((request.responseText == -1) &amp;&amp; (callNum &lt; numCalls))&#xD;     readanalogpulsepin(pin, callNum);&#xD;  else&#xD;     return request.responseText;&#xD;} else&#xD;    return "Not Connected";&#xD;}&#xD;&#xD;return readanalogpulsepin(pin, callNum);&#xD;</l></block><list><block var="pin_num"/></list></block></block></script></block-definition><block-definition s="stop all" type="command" category="control"><header></header><code></code><translations>ko:모두 멈추기&#xD;de:stoppe alles&#xD;pt:pare todos&#xD;fr:stop tout&#xD;nl:stop alle&#xD;zh_CN:停止 全部&#xD;zh_TW:停止 全部&#xD;ar:توقف الكل&#xD;dk:stop alle&#xD;he:להפסיק הכל&#xD;es:detener todo&#xD;ca:atura tot&#xD;fi:pysäytä kaikki&#xD;sv:stop allt&#xD;</translations><inputs></inputs><script><block s="doReport"><block s="reportURL"><block s="reportJoinWords"><list><l>http://127.0.0.1:30063/microbit/out/stopall</l></list></block></block></block></script></block-definition><block-definition s="micro:bit Print %&apos;string&apos;" type="command" category="looks"><header></header><code></code><translations>ko:micro:bit 출력 _&#xD;de:micro:bit Drucke _&#xD;pt:micro:bit Imprimir _&#xD;fr:micro:bit Imprimer _&#xD;nl:micro:bit Schrijf _&#xD;zh_CN:micro:bit 打印 _&#xD;zh_TW:micro:bit 打印 _&#xD;ar:micro:bit طباعة _&#xD;dk:micro:bit Vis _&#xD;he:micro:bit הדפס  _&#xD;es:micro:bit Imprimir _&#xD;ca:micro:bit Escriu _&#xD;fi:micro:bit Näytä teksti _&#xD;sv:micro:bit Visa text _&#xD;</translations><inputs><input type="%txt">Hello</input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>string</l></list><l>////////////////////////////////////////////////////////////////////////////////&#xD;// In order to avoid sending more messages than the app can handle, whenever we&#xD;// send a message we also save it in a persistent global variable. When the&#xD;// message is processed in the app, the callback checks if the global variable&#xD;// still matches what it was changed to. If it was, it deletes the global&#xD;// variable. Otherwise the message is resent with new data.&#xD;//&#xD;// When this block is called it checks if the global value has been set. If it&#xD;// has, it sends a message. Otherwise it just updates the value and lets the&#xD;// callback handle it.&#xD;&#xD;// Encode any special characters in the URL&#xD;string = encodeURIComponent(string);&#xD;&#xD;&#xD;// We can&apos;t run code beforehand to define values so we must check each block&#xD;// call if they are set.&#xD;if (window.birdbrain === undefined || window.birdbrain.printObj === undefined) {&#xD;    window.birdbrain = window.birdbrain || {};&#xD;    window.birdbrain.printObj = {&#xD;        // By attaching this function to a global variable, it is only&#xD;        // defined once instead of every time this block is called, improving&#xD;        // performance significantly.&#xD;        printString: function(string) {&#xD;            function callback() {&#xD;                if (window.birdbrain.printObj.stringToPrint === string) {&#xD;                    delete window.birdbrain.printObj.stringToPrint;&#xD;                }&#xD;                else {&#xD;                    window.birdbrain.printObj.printString(window.birdbrain.printObj.stringToPrint);&#xD;                }&#xD;            }&#xD;            /*&#xD;            var report = {&#xD;                message:"L".charCodeAt(0),&#xD;                port: port.toString().charCodeAt(0),&#xD;                intensity: intensity&#xD;            };&#xD;            chrome.runtime.sendMessage(hummingbirdAppID, report, callback);&#xD;            */&#xD;&#xD;            //Create a new XMLHttpRequest object&#xD;            var xhr = new XMLHttpRequest();&#xD;            var printURL = "http://127.0.0.1:30063/microbit/out/print/" + string;&#xD;            //console.log(printURL);&#xD;            xhr.open("GET", printURL, true);&#xD;            xhr.onload = function (e) {&#xD;              if (xhr.readyState === 4) {&#xD;                if (xhr.status === 200) {&#xD;                  callback();&#xD;                } else {&#xD;                  console.error(xhr.statusText);&#xD;                }&#xD;              }&#xD;            };&#xD;            xhr.onerror = function (e) {&#xD;              console.error(xhr.statusText);&#xD;            };&#xD;            xhr.send(null);&#xD;&#xD;        }&#xD;    }&#xD;}&#xD;&#xD;//TODO Turn &apos;/&apos; chars into % &#xD;&#xD;if (window.birdbrain.printObj.stringToPrint === undefined) {&#xD;  window.birdbrain.printObj.printString(string);&#xD;}&#xD;&#xD;window.birdbrain.printObj.stringToPrint = string;</l></block><list><block var="string"/></list></block><block s="doWait"><l>0</l></block></script></block-definition><block-definition s="read %&apos;level&apos; pulse on pin %&apos;pin_num&apos; µs" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">high<options>high&#xD;low</options></input><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input></inputs><script><block s="doIfElse"><block s="reportEquals"><block var="level"/><l>high</l></block><script><block s="doSetVar"><l>level</l><l>1</l></block></script><script><block s="doSetVar"><l>level</l><l>0</l></block></script></block><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>pin</l><l>level</l></list><l>var numCalls = 100;&#xD;var callNum = 0;&#xD;function readanalogpulsepin (pin, level, callNum) {&#xD;var request = new XMLHttpRequest();&#xD;var ledURL = "http://127.0.0.1:30063/microbit/in/dreadpulsepin/" + pin +"/" + level;&#xD;request.open(&apos;GET&apos;, ledURL, false);  // `false` makes the request synchronous&#xD;request.send(null);&#xD;&#xD;&#xD;//console.log(callNum);&#xD;callNum++;&#xD;if (request.status === 200) {&#xD;  //console.log(request.responseText);&#xD;  if ((request.responseText == -1) &amp;&amp; (callNum &lt; numCalls))&#xD;     readanalogpulsepin(pin, level, callNum);&#xD;  else&#xD;     return request.responseText;&#xD;} else&#xD;    return "Not Connected";&#xD;}&#xD;&#xD;return readanalogpulsepin(pin, level, callNum);&#xD;</l></block><list><block var="pin_num"/><block var="level"/></list></block></block></script></block-definition><block-definition s="read Distance (cm) sensor on pin %&apos;echoPin&apos; set trigger on pin %&apos;triggerPin&apos;" type="reporter" category="sensing"><header></header><code></code><translations></translations><inputs><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input><input type="%s" readonly="true">0<options>0&#xD;1&#xD;2&#xD;3&#xD;4&#xD;5&#xD;6&#xD;7&#xD;8&#xD;9&#xD;10&#xD;11&#xD;13&#xD;14&#xD;15&#xD;16</options></input></inputs><script><custom-block s="set digital pin %s to %s"><block var="triggerPin"/><l>1</l></custom-block><block s="doWait"><l>0.1</l></block><custom-block s="set digital pin %s to %s"><block var="triggerPin"/><l>0</l></custom-block><block s="doReport"><block s="reportRound"><block s="reportQuotient"><custom-block s="read %s pulse on pin %s µs"><l>high</l><block var="echoPin"/></custom-block><l>58</l></block></block></block></script></block-definition></blocks><variables><variable name="pulseWidthus"><l>6980</l></variable><variable name="delay"><l>0.0742421875</l></variable><variable name="servoAngleDegrees"><l>77</l></variable><variable name="turnLevel"><l>43</l></variable><variable name="rotationSpeed"><l>-14</l></variable><variable name="distance"><l>179</l></variable><variable name="switch state"><l>1</l></variable></variables></project><media name="microbitTestProject" app="Snap! 6, https://snap.berkeley.edu" version="1"></media></snapdata>