-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.blocks
10 lines (10 loc) · 12.2 KB
/
main.blocks
1
2
3
4
5
6
7
8
9
10
<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="x]Ph$Cjo*9sM]QG$:2:M">minute</variable><variable id="bXd8+/kWAokP#B,)$^7E">s</variable><variable id="b~]4n]=em43nNhfa6S#K">s_old</variable><variable id="Mk388_+yW5/-WE8D]2G+">x</variable><variable id="~PO,0vzg;H:Jso$g-e{w">y</variable><variable id="zXE=p_5AngI`Cl;hA5M?">minute2</variable></variables><block type="pxt-on-start" id="xpxBWvycW$)I!qbK[TZn" x="-742" y="-7"><statement name="HANDLER"><block type="variables_set" id="vFIg5{8|n~,M1+[4UOSu"><field name="VAR" id="zXE=p_5AngI`Cl;hA5M?">minute2</field><value name="VALUE"><shadow type="math_number" id="(r`-SgBEwNT#-FkM{-bb"><field name="NUM">0</field></shadow></value><next><block type="synth_set_volume" id="~C!ZllA%pZvb59%@Xi!1"><value name="volume"><shadow type="math_number_minmax" id="q[E`Dyv(O?pU^Tt)?}zi"><mutation min="0" max="255" label="Number" precision="0"></mutation><field name="SLIDER">32</field></shadow></value></block></next></block></statement></block><block type="device_button_event" id="Y;Ry,:JF[?`YwhxBtoi@" x="0" y="0"><field name="NAME">Button.B</field><comment pinned="false" h="80" w="160">Create variables</comment><statement name="HANDLER"><block type="device_show_number" id="_|7vx/RF=KEtY#ZWz))x"><comment pinned="false" h="80" w="160">Show temperature_upper.</comment><value name="number"><block type="DS3231_GET_TEMPU" id="Qr(%r+w/kN+/Rpw_tPc`"></block></value><next><block type="device_pause" id="|0S8TvU8%S7M:7Nj0KBw"><value name="pause"><shadow type="timePicker" id="|pulU@ag-#?/95vZ{Mm/"><field name="ms">5000</field></shadow></value></block></next></block></statement></block><block type="device_forever" id="[zh~*NGL3MP4F0oI1khm" x="-300" y="102"><statement name="HANDLER"><block type="typescript_statement" id="5H2QJ(_%QVe75m}aR-`E" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="let x: number;" numlines="1" declaredvars="x"></mutation><next><block type="typescript_statement" id="[email protected]%Z%7WyU" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="let y: number;" numlines="1" declaredvars="y"></mutation><next><block type="variables_set" id="nOCq@k;a=gD,1hBb8sBU"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field><comment pinned="false" h="80" w="160">Every minute, play a sound.
Every 10 seconds, play another sound.
Every second, play another sound.
Try to show the value of seconds with an LED.
With 25 LEDs, seconds between 0 and 24 are shown, then display
goes dark until the end of the minute.</comment><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="DS3231_GET_SECOND" id="x@!%!U+qZp3u{~c]_E^D"></block></value><next><block type="controls_if" id="cm*z!U#d:B+j,WlW;n2h"><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="wfGnV^/z;0Qd.jT`fCb;"><field name="OP">NEQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="?q(A$YBCkWZS,0rDAnDO"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field></block></value><value name="B"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="bMk|pnO$u4.bD_P;L;(d"><field name="VAR" id="b~]4n]=em43nNhfa6S#K">s_old</field></block></value></block></value><statement name="DO0"><block type="variables_set" id="o(5d|8DRRe_6rS~jnYuW"><field name="VAR" id="b~]4n]=em43nNhfa6S#K">s_old</field><comment pinned="false" h="80" w="160">if seconds changed, do something, else repeat</comment><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="V(EiXTy@)kqT*xX~s0^u"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field></block></value><next><block type="controls_if" id="h|-C|38p|kSoUwA]avCM"><mutation elseif="1" else="1"></mutation><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="{V/X1l}4#wIyj_35:{ec"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="8)uI27[O)oScx6id@|B!"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field></block></value><value name="B"><shadow type="math_number" id="WifQ|izP6@p#{f,`nmsx"><field name="NUM">0</field></shadow></value></block></value><statement name="DO0"><block type="device_play_note" id="ISuO/:{(;YU{yLUuu{OX"><value name="note"><shadow type="device_note" id="ohh6o04_7/iIV!1eeJ%U"><field name="name">523</field></shadow></value><value name="duration"><shadow type="device_beat" id="p3u~W,nNF7aKqtnBMJHR"><field name="fraction">BeatFraction.Sixteenth</field></shadow></value></block></statement><value name="IF1"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="g_(BxpX$dUe6Dr~M-2n@"><field name="OP">EQ</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_modulo" id="1;~26Y%O(ZVgJk3=KA%~"><value name="DIVIDEND"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="QlPHdcl6iWYz!adaY56i"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field></block></value><value name="DIVISOR"><shadow type="math_number" id="tt~a*s@*Y,IoP-[S63r3"><field name="NUM">10</field></shadow></value></block></value><value name="B"><shadow type="math_number" id="hbYWaXyZsA7o.)P#$85W"><field name="NUM">0</field></shadow></value></block></value><statement name="DO1"><block type="device_play_note" id="|1gfzl^_n/;,Af_s|_w|"><value name="note"><shadow type="device_note" id="4S1uv0L9]xqYca?7Q9Ok"><field name="name">523</field></shadow></value><value name="duration"><shadow type="device_beat" id="QG1oI,K5vQ+)7%x3*.0@"><field name="fraction">BeatFraction.Half</field></shadow></value></block></statement><statement name="ELSE"><block type="device_play_note" id=";%csuvS`sO_7c^vH367s"><value name="note"><shadow type="device_note" id="bLK1~w;oWhCeq:3#_tY0"><field name="name">131</field></shadow></value><value name="duration"><shadow type="device_beat" id="{v2t$+LhwUS``8u`bG5V"><field name="fraction">BeatFraction.Sixteenth</field></shadow></value></block></statement><next><block type="variables_set" id="vK95H4~H+G3D?Jvob2#^"><field name="VAR" id="Mk388_+yW5/-WE8D]2G+">x</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_js_round" id="?AH2{1VrfM*l-yqA`#5q"><field name="OP">floor</field><value name="ARG0"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_arithmetic" id="+rB)*4e~d1So=K]lici1"><field name="OP">DIVIDE</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="nj=n)=2aJe9:B4u}o5Qg"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field></block></value><value name="B"><shadow type="math_number" id="Uoe,6*j,Sfhp/qVrX+b3"><field name="NUM">5</field></shadow></value></block></value></block></value><next><block type="variables_set" id="6q:g}DZXH7M?eW%!i~2E"><field name="VAR" id="~PO,0vzg;H:Jso$g-e{w">y</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_modulo" id="=AVq5CXa7KW-P]L7k#?%"><value name="DIVIDEND"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="variables_get" id="m@j`)LydlNA2e1Xo1h4R"><field name="VAR" id="bXd8+/kWAokP#B,)$^7E">s</field></block></value><value name="DIVISOR"><shadow type="math_number" id="@r!k(A56j,^NTNomDX;]"><field name="NUM">5</field></shadow></value></block></value><next><block type="device_clear_display" id="RZ][m*j1d|LqNp]c^O|c"><next><block type="device_plot" id="gAF1Js$M(A;8H?NR/?!Y"><value name="x"><shadow type="math_number_minmax"><mutation min="0" max="4"></mutation><field name="SLIDER">0</field></shadow><block type="variables_get" id="}N+@:R,;`5x%n/d4-Lzr"><field name="VAR" id="Mk388_+yW5/-WE8D]2G+">x</field></block></value><value name="y"><shadow type="math_number_minmax"><mutation min="0" max="4"></mutation><field name="SLIDER">0</field></shadow><block type="variables_get" id="3$}Ctzc{T+VB~5W9$^]$"><field name="VAR" id="~PO,0vzg;H:Jso$g-e{w">y</field></block></value></block></next></block></next></block></next></block></next></block></next></block></statement></block></next></block></next></block></next></block></statement></block><block type="device_button_event" id="(1P8TMOuZ1IEjsz0sLt1" x="-744" y="233"><field name="NAME">Button.A</field><statement name="HANDLER"><block type="typescript_statement" id=";j)~vOUMV-X);i.{|_Wk" editable="false"><mutation xmlns="http://www.w3.org/1999/xhtml" line0="let minute: number;" numlines="1" declaredvars="minute"></mutation><next><block type="controls_if" id="Ebl.,J@~e#6JeM-vt,(w"><mutation else="1"></mutation><comment pinned="false" h="80" w="160">Reset seconds.
If current seconds value > 30, the minutes are increased by 1.
If current seconds value <= 30, the minutes are left as is.
NOTE: If minute == 59 and value > 30, an attempt will be made to set minute to 60.
I am not sure what happens in this case.</comment><value name="IF0"><shadow type="logic_boolean"><field name="BOOL">TRUE</field></shadow><block type="logic_compare" id="AZ@Dq0G56`YjEro_{h:."><field name="OP">GT</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="DS3231_GET_SECOND" id="k2ChK[7P,BhNQc|48$^V"></block></value><value name="B"><shadow type="math_number" id="dJmOn}-Tac98M4:_V$`H"><field name="NUM">30</field></shadow></value></block></value><statement name="DO0"><block type="variables_set" id="Ktnk7wz?rn:7]HBalJ0r"><field name="VAR" id="x]Ph$Cjo*9sM]QG$:2:M">minute</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="math_arithmetic" id=".}@)tp*Tq%_=qcd2#}.9"><field name="OP">ADD</field><value name="A"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="DS3231_GET_MINUTE" id=":5!=B7W/hnX/^QVQnVh,"></block></value><value name="B"><shadow type="math_number" id="?@C,Gqd9@f`{t2~X`/bX"><field name="NUM">1</field></shadow></value></block></value></block></statement><statement name="ELSE"><block type="variables_set" id="m^o/o6_!nQTl.6rX0U90"><field name="VAR" id="x]Ph$Cjo*9sM]QG$:2:M">minute</field><value name="VALUE"><shadow type="math_number"><field name="NUM">0</field></shadow><block type="DS3231_GET_MINUTE" id=".2Z|@q+{ymUq~W;/~b#."></block></value></block></statement><next><block type="DS3231_SET_DATETIME" id="b9kPg)vx~,d^}bt)Dw{A"><value name="year"><shadow type="math_number_minmax"><mutation min="2000" max="2099"></mutation><field name="SLIDER">0</field></shadow><block type="DS3231_GET_YEAR" id="5VS4suX8Q?~1*v$.6CF~"></block></value><value name="month"><shadow type="math_number_minmax"><mutation min="1" max="12"></mutation><field name="SLIDER">0</field></shadow><block type="DS3231_GET_MONTH" id="Fq4h.GMY}#4SkKVT7?Qa"></block></value><value name="date"><shadow type="math_number_minmax"><mutation min="1" max="31"></mutation><field name="SLIDER">0</field></shadow><block type="DS3231_GET_DATE" id="s%B3!AwQq#I{A%/*w8Rv"></block></value><value name="day"><shadow type="math_number_minmax"><mutation min="1" max="7"></mutation><field name="SLIDER">0</field></shadow><block type="DS3231_GET_DAY" id=")E},Anu[Y.Bh3ud6GBc2"></block></value><value name="hour"><shadow type="math_number_minmax"><mutation min="0" max="23"></mutation><field name="SLIDER">0</field></shadow><block type="DS3231_GET_HOUR" id="ULkzrgS}xZlv{P(gPE!d"></block></value><value name="minute"><shadow type="math_number_minmax"><mutation min="0" max="59"></mutation><field name="SLIDER">0</field></shadow><block type="variables_get" id="fp6deS?P}p9VT:#d0Z.v"><field name="VAR" id="x]Ph$Cjo*9sM]QG$:2:M">minute</field></block></value><value name="second"><shadow type="math_number_minmax" id="4{Y:y9S[d5nE|#2W9h7~"><mutation min="0" max="59" label="Number" precision="0"></mutation><field name="SLIDER">0</field></shadow></value><next><block type="device_show_number" id=",m}WjBW_itzjx])Uon}}"><value name="number"><block type="DS3231_GET_MINUTE" id="|1q7XlBjyd/-NL`CtcWO"></block></value><next><block type="device_show_number" id="~=f^_#8u`PCwZof7]%Kn"><value name="number"><block type="DS3231_GET_SECOND" id=",r]o;xf,o~0y|o63Eq$*"></block></value></block></next></block></next></block></next></block></next></block></statement></block></xml>