@tmischek sagte: mir ist nicht klar welche Variablen
Frage zu WLED: Ist blau = 1 (set / preset) und rot = 4? Eingeschaltet wird über "On / Off"?
Falls ja, dann mache es so:
Blockly_temp.JPG
Export
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="/AEWVRh+Lt$Y9I@F87=k">farbe</variable>
<variable id="@3I1[ojTf5.NM)#n9F#M">ein</variable>
</variables>
<block type="on" id="eaW_bKnAgk]}(DPp,.^U" x="62" y="-87">
<field name="OID">0_userdata.0.Blockly.Tuer</field>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id="Eh}U9t-+S~f!e=UpCWsi">
<mutation name="LED"></mutation>
</block>
</statement>
<next>
<block type="on" id="~*}7+xYP^,0H-)p~SCSG">
<field name="OID">0_userdata.0.Blockly.Status</field>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id=")xt![a_^6-(%mi~oED4t">
<mutation name="LED"></mutation>
<next>
<block type="control" id=":vgb:qMW0|4zK*ZFy)xK">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">Object ID</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="logic_ternary" id="AUz+{@lxzKt1{Ws;:i$)">
<value name="IF">
<block type="on_source" id=":9=Mz*9g;|=Wd7s~Mmu[">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="THEN">
<block type="text" id="95dhl(#0X6Nw|VDnDT~*">
<field name="TEXT">Backofen eingeschaltet</field>
</block>
</value>
<value name="ELSE">
<block type="text" id="@0,9x!pubLaw3olbxtOV">
<field name="TEXT">Backofen ausgeschaltet</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
<block type="procedures_defnoreturn" id="*y2p~o.ZG$.}DHl2EHoe" x="263" y="-87">
<field name="NAME">LED</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="variables_set" id="c_ba-Bft:u=o|%(Tf};d">
<field name="VAR" id="/AEWVRh+Lt$Y9I@F87=k">farbe</field>
<value name="VALUE">
<block type="logic_ternary" id="S6+JzDi(viZL*a_WEKPq">
<value name="IF">
<block type="get_value" id="WY~Y*2B/5Mh+BRaYQ|T;">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.Blockly.Tuer</field>
</block>
</value>
<value name="THEN">
<block type="math_number" id="0$%i#3/?y2#$1,@g}/F}">
<field name="NUM">4</field>
</block>
</value>
<value name="ELSE">
<block type="math_number" id="9gC-6M5#iDVA+1#=/O~s">
<field name="NUM">1</field>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="KHN!jGp87NH~^E1Go%Al">
<field name="VAR" id="@3I1[ojTf5.NM)#n9F#M">ein</field>
<value name="VALUE">
<block type="logic_operation" id="0C1D-/YoeGmsOjU=:t[v" inline="false">
<field name="OP">OR</field>
<value name="A">
<block type="get_value" id="kH{q]axh%imMNken/O0+">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.Blockly.Status</field>
</block>
</value>
<value name="B">
<block type="logic_compare" id=",rP/qCwywor)LO$s}@,[">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="z{M~Nr*=%R.HDrWreGBO">
<field name="VAR" id="/AEWVRh+Lt$Y9I@F87=k">farbe</field>
</block>
</value>
<value name="B">
<block type="math_number" id="R0=SeY;?]`lfa1X$V(P9">
<field name="NUM">4</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="control" id=",30v;$XzA*;HDK/zA0Ng">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">Object ID</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="s;nYu{(Wcqy!)(0I@GS`">
<field name="VAR" id="/AEWVRh+Lt$Y9I@F87=k">farbe</field>
</block>
</value>
<next>
<block type="control" id="N^@1WmGg}26NGv7z[|:t">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">Object ID</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="Ef=drLc3F5^3dq9TVz~3">
<field name="VAR" id="@3I1[ojTf5.NM)#n9F#M">ein</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>
"LED" ist eine Funktion, "farbe" und "ein" sind selbst erstellte Variablen.