@paul53 said in Taster press short or long mit blockly :
@AxelF1977 sagte:
die bleiben so lange auf true, bis der Taster wieder losgelassen wird.
Dann versuche es mal damit für die linken Taster (AI: Ein/Heller; AO: Aus/Dunkler):
Spoiler
<xml xmlns="http://www.w3.org/1999/xhtml">
<variables>
<variable type="" id=".0n)fPPZ0Vnq@(#OkayL">level</variable>
<variable type="" id="aJZ]={d,#UG6hNfL+g%q">button</variable>
<variable type="" id="U0|}x*G;[=9}9Ql;A}WY">ein</variable>
<variable type="" id="LOUNWT3$L)e!L@xYU#}h">step</variable>
<variable type="" id="r@NrZq0IZi*lPW#AYK/Q">delta</variable>
<variable type="" id="R*r}N3kzibH)Apx7BA2q">long</variable>
<variable type="undefined" id="timeout">timeout</variable>
<variable type="undefined" id="Intervall">Intervall</variable>
</variables>
<block type="variables_set" id="mBjs]l~k+|EXhuQdommL" x="-313" y="-387">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
<value name="VALUE">
<block type="get_value" id="X`JY{Vb._~,oJne_SWOY">
<field name="ATTR">val</field>
<field name="OID">ID auswählen</field>
</block>
</value>
<next>
<block type="variables_set" id="BZ25)c-VK5Z[3goO6AO@">
<field name="VAR" id="LOUNWT3$L)e!L@xYU#}h" variabletype="">step</field>
<value name="VALUE">
<block type="math_number" id=";wxnn-=7*b4-c-IMf:=:">
<field name="NUM">5</field>
</block>
</value>
<next>
<block type="comment" id="k5O@A`WZ%=k2SxN%R*eR">
<field name="COMMENT">AI</field>
<next>
<block type="on_ext" id="9A$Wi*GJ.dRaDpyO`/xI">
<mutation items="1"></mutation>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="/c7pXjT/I+1ho9^BP9Uz">
<field name="oid">default</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="variables_set" id="@G{{4oK*6TJZL#zVETGB">
<field name="VAR" id="r@NrZq0IZi*lPW#AYK/Q" variabletype="">delta</field>
<value name="VALUE">
<block type="variables_get" id="o53B6/DeytPJHbI;Mi7O">
<field name="VAR" id="LOUNWT3$L)e!L@xYU#}h" variabletype="">step</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="dFHtN~%maUxxB.]?1tcM">
<mutation name="licht">
<arg name="button"></arg>
<arg name="ein"></arg>
</mutation>
<value name="ARG0">
<block type="on_source" id="WE@9|8|/~vvX{OXDYb}[">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="ARG1">
<block type="logic_boolean" id="Yu9B::0if$v]tT:bxB*U">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</next>
</block>
</statement>
<next>
<block type="comment" id="jSZ/2_c*((aR7,pNt)0y">
<field name="COMMENT">AO</field>
<next>
<block type="on_ext" id="W{d|e4vAl3#[=|KF-G3+">
<mutation items="1"></mutation>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="@rAa%8m;](ekf2C:~We8">
<field name="oid">default</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="variables_set" id="gc~P[z$.$-v%j:u^XOI)">
<field name="VAR" id="r@NrZq0IZi*lPW#AYK/Q" variabletype="">delta</field>
<value name="VALUE">
<block type="math_single" id="j!c[p($INLWaurOn$@GR">
<field name="OP">NEG</field>
<value name="NUM">
<shadow type="math_number" id="J+I;Y,iqn1nqZM15lVe,">
<field name="NUM">9</field>
</shadow>
<block type="variables_get" id="};j080s`b2/m%hM-3JlK">
<field name="VAR" id="LOUNWT3$L)e!L@xYU#}h" variabletype="">step</field>
</block>
</value>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id="_vI+=tBli*j-/rK10bmF">
<mutation name="licht">
<arg name="button"></arg>
<arg name="ein"></arg>
</mutation>
<value name="ARG0">
<block type="on_source" id="q-S~S+O0usUFEH29nW-E">
<field name="ATTR">state.val</field>
</block>
</value>
<value name="ARG1">
<block type="logic_boolean" id="$/j)O2ra|t9)h^$@i$!O">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
<block type="procedures_defnoreturn" id="0[(od3jtT2]$A1$a$};A" x="137" y="-363">
<field name="NAME">dimm</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="math_change" id="ay^:v^GMiK8;@C.C{91L">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
<value name="DELTA">
<shadow type="math_number" id=",p-gkt;Nv8#h2}*;XqVf">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="-hl/L_),_!x:MXDb=iyJ">
<field name="VAR" id="r@NrZq0IZi*lPW#AYK/Q" variabletype="">delta</field>
</block>
</value>
<next>
<block type="controls_if" id="%kszP{vBYtCwZ/qzTtSa">
<value name="IF0">
<block type="logic_compare" id="-.%Q*lZ}FCy~^wP+p[:1">
<field name="OP">GT</field>
<value name="A">
<block type="variables_get" id="UA:CC7Vx~omd?~j2gEKs">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
</block>
</value>
<value name="B">
<block type="math_number" id="99D.}K4,`E`IF@EOxgvF">
<field name="NUM">100</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="v0aJHm1a3E.+HF6~ocI$">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
<value name="VALUE">
<block type="math_number" id="EtU#raSrJ7YV0iWJf:5J">
<field name="NUM">100</field>
</block>
</value>
</block>
</statement>
<next>
<block type="controls_if" id="beN!nf7!FvW*:[ddES,]">
<value name="IF0">
<block type="logic_compare" id="79QUCa4(?d3Oot-2GPSk">
<field name="OP">LT</field>
<value name="A">
<block type="variables_get" id="~ZX5X]P$m)=9n4?B@8~-">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
</block>
</value>
<value name="B">
<block type="math_number" id="3:t:FbgDD?xLq~RgPObL">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="6-eEI]Ym2;J;X:G_J6rv">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
<value name="VALUE">
<block type="math_number" id=")Y-{eso01`GWZ-YsFUf;">
<field name="NUM">0</field>
</block>
</value>
</block>
</statement>
<next>
<block type="control" id="[Ly(jC0qvD44B2M,`N;q">
<mutation delay_input="false"></mutation>
<field name="OID">Object ID</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="Zxd5^AHW3x`7Y(^h!Z?{">
<field name="VAR" id=".0n)fPPZ0Vnq@(#OkayL" variabletype="">level</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="NWZF^.s##C!,EL2.W.0%" x="137" y="-88">
<mutation>
<arg name="button" varid="aJZ]={d,#UG6hNfL+g%q"></arg>
<arg name="ein" varid="U0|}x*G;[=9}9Ql;A}WY"></arg>
</mutation>
<field name="NAME">licht</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
<statement name="STACK">
<block type="controls_if" id="8oO0{BL}4az$9-8hSj?N">
<mutation else="1"></mutation>
<value name="IF0">
<block type="variables_get" id="lYX/%Zr4$W!`HeoKa0|7">
<field name="VAR" id="aJZ]={d,#UG6hNfL+g%q" variabletype="">button</field>
</block>
</value>
<statement name="DO0">
<block type="variables_set" id="dbYw|pz[1kS)^NPuNqE|">
<field name="VAR" id="R*r}N3kzibH)Apx7BA2q" variabletype="">long</field>
<value name="VALUE">
<block type="logic_boolean" id="`A80q|79.cVrAN3@zzkX">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="timeouts_settimeout" id="c#ncZp7EQ8*QJ=XCRZ8Q">
<field name="NAME">timeout</field>
<field name="DELAY">500</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="variables_set" id="TeeqM~uQR#SuLH3?:V?j">
<field name="VAR" id="R*r}N3kzibH)Apx7BA2q" variabletype="">long</field>
<value name="VALUE">
<block type="logic_boolean" id="llYi+Cqf.bt/).4]RgFz">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="procedures_callnoreturn" id=",b+2?RiSiTW:]fvU7,.6">
<mutation name="dimm"></mutation>
<next>
<block type="timeouts_setinterval" id=".3yOZ$x;4,sop[Q(rj8#">
<field name="NAME">Intervall</field>
<field name="INTERVAL">250</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="procedures_callnoreturn" id="ORqY8t}R;isC4Qbus(+^">
<mutation name="dimm"></mutation>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="timeouts_cleartimeout" id="Zx?~y{}iOq-zpH-/|j;[">
<field name="NAME">timeout</field>
<next>
<block type="timeouts_clearinterval" id="R.=w_d*Xk3h6nUuanj51">
<field name="NAME">Intervall</field>
<next>
<block type="controls_if" id="Dir-(XSm)akkXs3-Y^xH">
<value name="IF0">
<block type="logic_negate" id="N,HqW]LM,^8!@tY0P)wK">
<value name="BOOL">
<block type="variables_get" id=".{q|vn^g`}@9EpN{;zsZ">
<field name="VAR" id="R*r}N3kzibH)Apx7BA2q" variabletype="">long</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="G)M!#H6*^$UaGALg/o7I">
<mutation delay_input="false"></mutation>
<field name="OID">Object ID</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="WEi5d_diWt-*v)6q.f5R">
<field name="VAR" id="U0|}x*G;[=9}9Ql;A}WY" variabletype="">ein</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</xml>
Wie krass! Das funktioniert, unglaublich.
Ein wenig zickig ist es noch, nach loslassen der Tasten dimmt er noch weiter hoch oder runter, mal einen Schritt, mal mehrere, ich glaube je nachdem wie lange gedrückt war.
Wo muss ich was ändern, dass er bei langem Drücken nicht so weit runter dimmt, dass das Licht ausgeht, sondern bis max 10%
Ich habe mal die Anordnung der Button geändert, A0 ist oben und AI unten
Sonst scheint das sehr gut zu laufen.
Ich bin mehr als beeindruckt.