-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.blocks
More file actions
1 lines (1 loc) · 16.3 KB
/
Copy pathmain.blocks
File metadata and controls
1 lines (1 loc) · 16.3 KB
1
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="4buU$z?W1rI@x{UvUS|9">alarmOn</variable><variable id="yJUtInRsdjk:e5lqlt`h">receivedRadio</variable><variable id="Ud}poX{:0vMeIp`Ya_$V">broadcastOn</variable></variables><block type="pxt-on-start" id="J*yC;cIdH%MaCLT)wW1H" x="-517" y="-211"><comment pinned="false" h="80" w="160" relx="10" rely="10">This is the start sequence that sets all of the transmissions state into the boolean.</comment><statement name="HANDLER"><block type="variables_set" id="D(L*)y.Ni0CezOLxi*1l"><field name="VAR" id="4buU$z?W1rI@x{UvUS|9">alarmOn</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="z.KoDThpb#M{{Hb`8@It"><field name="BOOL">FALSE</field></block></value><next><block type="variables_set" id="!,[=UJZIEbYc?U6{9?Ea"><field name="VAR" id="Ud}poX{:0vMeIp`Ya_$V">broadcastOn</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="?2kjiGbq6Eoutea69`e`"><field name="BOOL">FALSE</field></block></value><next><block type="radio_set_group" id="-HJ6:d3:Z,2(bQ`ksv??"><value name="ID"><shadow type="math_number_minmax" id="!)yR/Zkka3[xK#zXoAdK"><mutation min="0" max="255" label="Id" precision="0"/><field name="SLIDER">192</field></shadow></value></block></next></block></next></block></statement></block><block type="device_forever" id="1dT),(?_yX#9VwERDCW+" x="-142" y="-215"><comment pinned="false" h="80" w="160" relx="10" rely="10">Specific to the micro:bit version 2</comment><statement name="HANDLER"><block type="music_set_built_in_speaker_enable" id=".B:Yr2``zY{(DG%2Oa2i"><value name="enabled"><shadow type="toggleOnOff" id="-Fo#3])u]EoQ+TiDjG2A"><field name="on">true</field></shadow></value></block></statement></block><block type="device_button_event" id="HPEzSoX}O/k/0Ao!t,Vj" x="0" y="0"><field name="NAME">Button.A</field><comment pinned="false" h="80" w="160" relx="10" rely="10">This is button is for viewing the broadcast and shutting the alarm down</comment><statement name="HANDLER"><block type="controls_if" id="vP,lo12uF)bhP{[Li@Yl"><mutation else="1"/><comment pinned="false" h="80" w="160" relx="10" rely="10">If statement: If the transmissions did arrived before pressing the button, it will execute the next sequence. Else it will show an error screen.</comment><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="zhV?!:0|)@#m6t2$c4|i"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="$*dGFB2]Rjhb6-s]x.i="><field name="VAR" id="4buU$z?W1rI@x{UvUS|9">alarmOn</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="9EjTM%q-t2=WAqEsz8,7"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO0"><block type="variables_set" id="k|#$vW(+]Po`ok)wq*Wo"><field name="VAR" id="4buU$z?W1rI@x{UvUS|9">alarmOn</field><comment pinned="false" h="80" w="160" relx="10" rely="10">Set this off to turn off an annoying alarm.</comment><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="h+K{iBHjhGc,6~`3)[zb"><field name="BOOL">FALSE</field></block></value><next><block type="variables_set" id="#Zhv~ltgx2H*}Hkf.wsz"><field name="VAR" id="Ud}poX{:0vMeIp`Ya_$V">broadcastOn</field><comment pinned="false" h="80" w="160" relx="10" rely="10">Setting this on will tell a state of broadcast</comment><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id=";76n*to#TUx.GOToVeGr"><field name="BOOL">TRUE</field></block></value><next><block type="playMelody" id="OW2Qnl1fcP5b.oFR5dcT"><value name="melody"><shadow type="melody_editor" id="?NnKbmsLL*Z^HDPA%S:)"><field name="melody">"C5 C5 C5 C5 C5 C5 C5 C5 "</field></shadow></value><value name="tempo"><shadow type="math_number_minmax" id="hF=_-PO`FcuvDf!vJ8$m"><mutation min="40" max="500" label="Number" precision="0"/><field name="SLIDER">240</field></shadow></value><next><block type="device_pause" id="4o=S^mGTZ]?A8?2q27C/"><value name="pause"><shadow type="timePicker" id="Z#~4@+^j!UO%6hiW6tf="><field name="ms">2000</field></shadow></value><next><block type="controls_if" id="AFd/:9*S4zHzrN}@{wRM"><mutation elseif="7" else="1"/><comment pinned="false" h="80" w="160" relx="10" rely="10">Query for broadcasting (Could be customised and all as much as you want, as long as the micro:bit storage is not full)</comment><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="/Sp_7lgw!kf6N]:c*![x"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="Y$~bIBqUr|d?DwYV`yIB"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="8x]04cK^EmQd/+U31U@w"><field name="NUM">0</field></shadow></value></block></value><statement name="DO0"><block type="typescript_statement" id="),[[TM~RXmlR@|=0bA(s" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("THIS IS A TEST FOR THE EMERGENCY RADIO TRANSMISSION SYSTEM, NO ACTION NEEDED.", 60)" numlines="1"></mutation></block></statement><value name="IF1"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="dvg:vo$pW|FG}pf4ryyf"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="p3TYyP]G)/qR]7izVIqO"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="xy$r[2_^ryY6Lr@#H,Cg"><field name="NUM">1</field></shadow></value></block></value><statement name="DO1"><block type="typescript_statement" id="K+NOPM@h5~VWJHt4vGeh" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("TYPHOON HAZARD WARNING, SHELTER YOURSELF AND KEEP THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><value name="IF2"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="($LHy=G(^tbL8B?h=v6("><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="T4dBL?4_I[yMKm=U8C~g"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="*oCa7H+dh+[!5-A{t5l|"><field name="NUM">2</field></shadow></value></block></value><statement name="DO2"><block type="typescript_statement" id="Kfe%W:BRHYD6km0*kE?v" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("FLASH FLOOD WARNING, STAY ON HIGH GROUNDS, GET NECESSARY FOOD SUPPLIES AND KEEP THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><value name="IF3"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="/c[NDv`S3*4|O6GO=!2#"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="PwL?%_W~s1DVgT:WlxDk"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="%Onb=YyH70KYf-nbEi?D"><field name="NUM">3</field></shadow></value></block></value><statement name="DO3"><block type="typescript_statement" id="M(lWaZ!Ev2C(!B4ESv/w" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("CIVIL DANGER WARNING, SHELTER YOURSELF NOW TO AVOID ANY DANGER AND KEEP THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><value name="IF4"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="9S[D64S]tGcIH,A4Fy{X"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="tpnKNbSF^6lp3r(wBsmD"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="jcCGggPYhxMmJLKESbZv"><field name="NUM">4</field></shadow></value></block></value><statement name="DO4"><block type="typescript_statement" id="#v_zVB`r;6BX`D3QX:`V" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("CIVIL DANGER WARNING, EVACUATION IS ADVISED FOR THIS AREA OR SHELTER IN YOUR AREA, AND DON'T FORGET BRING THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><value name="IF5"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="UjEP:};aQpHNEiglm-q="><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="2yXcot5Mg2~+PSLI9ksl"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="+{/^Jo(b~5$sY=p3;583"><field name="NUM">5</field></shadow></value></block></value><statement name="DO5"><block type="typescript_statement" id="YT!oN~:AF*M7%ig(S(-6" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("MANDATORY EVACUATION ORDER. EVACUATE THIS AREA NOW, THIS IS MANDATORY AND THE VIOLATION OF THIS ORDER COULD RESULT IN CERTAIN DEATH OR EXTREME INJURY. BRING THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><value name="IF6"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id=")^Ld*tj^x5J_HGUgj(|c"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="PF7=6f.mk$O.!lA0HsIW"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id="eh#x/DUp:Ytu9:|6X1xG"><field name="NUM">6</field></shadow></value></block></value><statement name="DO6"><block type="typescript_statement" id="ZD3/h]pTZe-S!AHTFmK~" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("NUCLEAR ATTACK IMMINENT, PEOPLE WITHIN THE RADIUS OF 10 KILOMETRES IS TO EVACUATE NOW OR DEATH IS IMMINENT. PEOPLE WITHIN THE 150 KILOMETRES OF THE CITY CENTRE MUST BUILD THEIR FALLOUT SHELTER, WITH THE SHELTER CLOSING ALL OF THE AIR ENTRANCES, NOW IN CASE THE FALLOUT ARE ARRIVING. BRING THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><value name="IF7"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="6k0HPPdca|0~.^Qx,k$%"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="ef/PIDFq4:Obf^w4hh~O"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field></block></value><value name="B"><shadow type="math_number" id=",/jkgr-hI}$fbM|E$6Gh"><field name="NUM">7</field></shadow></value></block></value><statement name="DO7"><block type="typescript_statement" id=":a~XHnky#A}{0ee;CwGl" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("FALLOUT ARRIVING TO YOUR AREA. IF YOU ARE RECEIVING THIS MESSAGE, GO TO YOUR FALLOUT SHELTER NOW. EVACUATION IS TOO LATE. IF THERE IS NO DESIGNATED AREA FOR THE FALLOUT SHELTER, BLOCK ALL OF THE WINDOWS AND VENTILATION SHAFT WITH AS MUCH AS THICKNESS AS POSSIBLE. BRING THIS MICROBIT BATTERY-POWERED AND WITH YOU FOR FURTHER UPDATES.", 75)" numlines="1"></mutation></block></statement><statement name="ELSE"><block type="typescript_statement" id="qy5XUpq5Y2fw(TSyNsnN" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="basic.showString("ALL CLEAR, YOU MAY CONTINUE YOUR LIVES AS NORMAL, RELIEF TEAM MIGHT BE SENT TO YOU IF YOU ARE IN THE AFFECTED AREA.", 75)" numlines="1"></mutation></block></statement><next><block type="playMelody" id="@PwPXba;)@kjBrbWP1MJ"><value name="melody"><shadow type="melody_editor" id="*T_v#l58t;b5EIjX^G:]"><field name="melody">"A A - A A - A A "</field></shadow></value><value name="tempo"><shadow type="math_number_minmax" id="UZdUR~TwO70A1[?S6sQ("><mutation min="40" max="500" label="Number" precision="0"/><field name="SLIDER">120</field></shadow></value><next><block type="variables_set" id="bUs^A+K|m~5^-?[)p-O;"><field name="VAR" id="Ud}poX{:0vMeIp`Ya_$V">broadcastOn</field><comment pinned="false" h="80" w="160" relx="10" rely="10">Set off the broadcastOn because the broadcast has ceased.</comment><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="Fwk9eY-Z4!%v8-RbT/)_"><field name="BOOL">FALSE</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></statement><statement name="ELSE"><block type="device_print_message" id="/R5O+hukt|z]MIJB#sG?"><comment pinned="false" h="80" w="160" relx="10" rely="10">Error 758: No transmission.</comment><value name="text"><shadow type="text" id="6D@U,MF=0#dK~E#Pu@{:"><field name="TEXT">No alarm to be broadcasted as of now. (Error 758)</field></shadow></value><next><block type="controls_repeat_ext" id="1*(ppMq:$pVOh1,v}YV{"><value name="TIMES"><shadow type="math_whole_number" id="l-t`2]5*H+3%hNIm/q@z"><field name="NUM">4</field></shadow></value><statement name="DO"><block type="playMelody" id="^h+acv{f}yKLyo49,fCr"><value name="melody"><shadow type="melody_editor" id="/LWvpAEl0pI{0]#q2REs"><field name="melody">"B C5 C E A C5 G A "</field></shadow></value><value name="tempo"><shadow type="math_number_minmax" id="khI_q^SYm(`C8@K1Aoo~"><mutation min="40" max="500" label="Number" precision="0"/><field name="SLIDER">240</field></shadow></value></block></statement></block></next></block></statement></block></statement></block><block type="radio_on_number_drag" id="/iQDi5i#5)hO}[96*.l3" x="-517" y="29"><comment pinned="false" h="80" w="160" relx="10" rely="10">This is to be triggered when the radio is transmitted to this micro:bit</comment><value name="HANDLER_DRAG_PARAM_receivedNumber"><shadow type="argument_reporter_number" id="+:41~^]kRQRidHM|qwU5"><field name="VALUE">receivedNumber</field></shadow></value><statement name="HANDLER"><block type="variables_set" id="ab(p]q*AHg}2UM(;j#SV"><field name="VAR" id="4buU$z?W1rI@x{UvUS|9">alarmOn</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="5$jOUS,GSSvlMCpHrhK*"><field name="BOOL">TRUE</field></block></value><next><block type="variables_set" id="!ZLf0KDo`y~!4EvXBkz?"><field name="VAR" id="yJUtInRsdjk:e5lqlt`h">receivedRadio</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="argument_reporter_number" id="Xmh9y?K4jR58ypYdxNcZ"><field name="VALUE">receivedNumber</field></block></value><next><block type="device_while" id="NFZR8$%(|0[)hJz6HHVn"><comment pinned="false" h="80" w="160" relx="10" rely="10">This plays alarm only when the alarmOn variable is true.</comment><value name="COND"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="LurBD9.@9#I7s^o,oPF["><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="$F-mTvcU6_y[QJ3(a5Et"><field name="VAR" id="4buU$z?W1rI@x{UvUS|9">alarmOn</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="logic_boolean" id="]K{aEciNYTqiSZmISz~c"><field name="BOOL">TRUE</field></block></value></block></value><statement name="DO"><block type="playMelody" id="6dbak~)oCVN0=0yoM0=g"><value name="melody"><shadow type="melody_editor" id="I#Lr#uJk)v%4r;6Jb]mE"><field name="melody">"A F A F A F A F "</field></shadow></value><value name="tempo"><shadow type="math_number_minmax" id="1X/+:by6JmCT.y^U=h7L"><mutation min="40" max="500" label="Number" precision="0"/><field name="SLIDER">500</field></shadow></value></block></statement></block></next></block></next></block></statement></block></xml>