- Home
- Deutsch
- Skripten / Logik
- Zufällige Farbe bei LED aber immer Hell
Zufällige Farbe bei LED aber immer Hell
-
Hallo Zusammen
Ich brauche wider mal Eure Hilfe.
Ich möchte das LED zufällig die Farbe wechseln.
Soweit habe ich es auch hinbekommen.
Sogar das zwischen durch reines Weiss kommt.
Doch habe ich das Problem, das ich die Helligkeit nicht regeln kann. Was mir auch logisch ist da die werte ja Zufällig sind. Aber befriedigend finde ich das nicht. Het jemand eine Idee wie ich das verbessern kann?Grüsse Stefan
-
ich fürchte so recht hast du es nicht hin bekommen. Steuere doch mal den Datenpunkt LED Garten Effekt 2 mehrfach mit wahr und falsch an (so 10 mal, im Abstand von 3 oder 4 Sekunden) und schau dann was passiert. Sollte interessant sein.
Nun aber zum Lösungsvorschlag:
bestimm nicht direkt RGB via random, sondern mach das über Hue und saturation, und Berechne die RGB Werte daraus. Für die Zeitsteuerung reicht ein einfaches Intervall alle 10 sekunden welches jedes 4. mal auf Weiss stellt.
Wichtig: Der State der bei den Funktionen als "white" und "brightness" hinein geht sollte der von Dir gewünschte Helligkeitswert sein, Wert zwischen 0 und 255
Im Spoiler auch das Skript zum importieren. Wichtig: Die Objekte für die Lampe und die Ansteuerung musst du natürlich verbinden
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="N+S{-H34qZZ!$=r3|SqF">brightness</variable> <variable id="tUKXdY?A|aGu!LO-M{Zv">red</variable> <variable id="(o7`tprU.1|M%2Xfb!%E">green</variable> <variable id=";,w=98}f%opPW-avv,,l">blue</variable> <variable id="*U,as^LZ6_4lu]7b70Bg">white</variable> <variable id="Ch`P=wO0h3dwgm;o#AyI">saturation</variable> <variable id="SJ`A30+]5x8]V,D}4N.d">hue</variable> <variable id="c{d|zK9J-^mydiuqy4^k">colval</variable> <variable id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</variable> <variable type="interval" id="interval">interval</variable> <variable id="6o(Fc]F:U;,$wO(?.NH@">colidx</variable> <variable id="/5BI_/.eYgz/x/;D$/1`">p</variable> <variable id="t1VsF,3yY1idJ][]QEhX">q</variable> <variable id="NuUl[0/-)M7AiHB:_4=l">t</variable> </variables> <block type="on" id="~C_#([Cujmw-UMSFQ48r" x="-613" y="-588"> <field name="OID">Object ID</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="controls_if" id="bM.k{{u2r|FzdX1GsOf3"> <mutation else="1"></mutation> <value name="IF0"> <block type="on_source" id="BTgp,!1+!S6s^OR9I$4m"> <field name="ATTR">state.val</field> </block> </value> <statement name="DO0"> <block type="control" id="IG9v*Jy#Qh8tpf^OtLcC"> <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="math_number" id="*C]^kg`!aE(;Cv$ECxoB"> <field name="NUM">100000</field> </block> </value> <next> <block type="variables_set" id="W;d*EWil1s4vmR2!L$I?"> <field name="VAR" id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</field> <value name="VALUE"> <block type="math_number" id="0G[%7F80Gq(PHm!9AIKQ"> <field name="NUM">0</field> </block> </value> <next> <block type="timeouts_setinterval" id="^=jYiMBFu2)O[*=#:N(V"> <field name="NAME">interval</field> <field name="INTERVAL">10</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="math_change" id="cK,(R2.gg8TJgg4WcT4A"> <field name="VAR" id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</field> <value name="DELTA"> <shadow type="math_number" id="sTtoCe#~7KjID`##{~FH"> <field name="NUM">1</field> </shadow> </value> <next> <block type="controls_if" id="yf2f~k:X/aCWS`jf$0x$"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="eC+t@[CXdKD8mrff6b}^"> <field name="OP">EQ</field> <value name="A"> <block type="math_modulo" id=")^D?B}C%F6}aESn#JjV="> <value name="DIVIDEND"> <shadow type="math_number" id="[J^!%jM73IYMZvC@#sP]"> <field name="NUM">64</field> </shadow> <block type="variables_get" id="1zb7U^/JSu+#mK`HI,f^"> <field name="VAR" id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</field> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id="-W}ZB|@(|sc1}0@NVOGZ"> <field name="NUM">4</field> </shadow> </value> </block> </value> <value name="B"> <block type="math_number" id="cn:.5*s%$~sQ:|KzlCXM"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="procedures_callnoreturn" id="`QZot:4yrVSDa2%?}v:g"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="math_number" id="P}B$jhy8s(6tH;5Ngwbm"> <field name="NUM">0</field> </block> </value> <value name="ARG1"> <block type="math_number" id="TVU0zf`0Oc#8YoeXr,;;"> <field name="NUM">0</field> </block> </value> <value name="ARG2"> <block type="math_number" id="[vomm]N-}C2]LJX~Q/lq"> <field name="NUM">0</field> </block> </value> <value name="ARG3"> <block type="get_value" id="_BRn^(3aI@.ue[qEK3oz"> <field name="ATTR">val</field> <field name="OID">select ID</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="procedures_callnoreturn" id="RtwEZdWd5Fe0?N(mhv{?"> <mutation name="RandomColor"> <arg name="brightness"></arg> </mutation> <value name="ARG0"> <block type="get_value" id="5d2+.|]6Siiz*jei3242"> <field name="ATTR">val</field> <field name="OID">select ID</field> </block> </value> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="control" id="QZ5~eNP5[C6HRn}#+QMw"> <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="math_number" id="hkXuMA]1;G_T~#)}#35e"> <field name="NUM">1000</field> </block> </value> <next> <block type="timeouts_clearinterval" id="#-7CDpA3JCbGZq9I#O+%"> <field name="NAME">interval</field> </block> </next> </block> </statement> </block> </statement> </block> <block type="procedures_defnoreturn" id="aP}w|+.,@*q`rODu3J_B" x="-12" y="-613"> <mutation> <arg name="red" varid="tUKXdY?A|aGu!LO-M{Zv"></arg> <arg name="green" varid="(o7`tprU.1|M%2Xfb!%E"></arg> <arg name="blue" varid=";,w=98}f%opPW-avv,,l"></arg> <arg name="white" varid="*U,as^LZ6_4lu]7b70Bg"></arg> </mutation> <field name="NAME">SetLight</field> <comment pinned="false" h="80" w="160">Describe this function...</comment> <statement name="STACK"> <block type="controls_if" id="|(53dj9G|NSRmnJ*0N$,"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="xqrv5|/5S8.!/~zVuYjv"> <field name="OP">GT</field> <value name="A"> <block type="variables_get" id="lEj[KUxelNUw+Kd7F4B4"> <field name="VAR" id="*U,as^LZ6_4lu]7b70Bg">white</field> </block> </value> <value name="B"> <block type="math_number" id="6P@nk$T?;=Tz*X^j6Acd"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="3.XivU52-3Fh3YN]ZW5f"> <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="a9icpq7a9/`n{/Xn(QK("> <field name="VAR" id="*U,as^LZ6_4lu]7b70Bg">white</field> </block> </value> <next> <block type="control" id=".3*trFdRI5Be|7BQr.;U"> <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="math_number" id="QWq%s{)XKc5$ev4+3vs~"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="JhMC[~Ug9;OhkDz2W9YB"> <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="math_number" id="KH/HHUM8h#hT-wk-.VCb"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="/$CBcoDDMOOmxgqvEw*4"> <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="math_number" id="W]{B#5vUFMft!Pl$50!x"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="control" id=";d#i7d}yL3EQ5a8RW,zS"> <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="|GMWE`C[,m~eNR4B7N-x"> <field name="VAR" id="*U,as^LZ6_4lu]7b70Bg">white</field> </block> </value> <next> <block type="control" id="KtUr~pS4Lp-Hp-hG.D~Y"> <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="r,)R=$9ZmOuHoVv@Ohh+"> <field name="VAR" id="tUKXdY?A|aGu!LO-M{Zv">red</field> </block> </value> <next> <block type="control" id="Ukr6S#M+8C,/Fl[s|9eF"> <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="qtsDeN$u7kvuk90;JHWN"> <field name="VAR" id="(o7`tprU.1|M%2Xfb!%E">green</field> </block> </value> <next> <block type="control" id="RNiqX?sq0nqE_%uQL=/7"> <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="}RN537?p8#%yiD^orH:l"> <field name="VAR" id=";,w=98}f%opPW-avv,,l">blue</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> <block type="procedures_defnoreturn" id="@1oB;QW}5ERO(#FNeEX5" x="463" y="-613"> <mutation> <arg name="brightness" varid="N+S{-H34qZZ!$=r3|SqF"></arg> </mutation> <field name="NAME">RandomColor</field> <comment pinned="false" h="80" w="160">Describe this function...</comment> <statement name="STACK"> <block type="variables_set" id="k$aWW*;TA1Dlioteux/Z"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> <value name="VALUE"> <block type="math_constrain" id="_+NeI^i5oxukOKKm*3i?"> <value name="VALUE"> <shadow type="math_number" id="!Ne-T/WY%c%JbXtUHW.o"> <field name="NUM">50</field> </shadow> <block type="variables_get" id="@Irwy}T,7eSgXAJPDg)0"> <field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field> </block> </value> <value name="LOW"> <shadow type="math_number" id="S:z}E(db,neF86Q_tDHo"> <field name="NUM">0</field> </shadow> </value> <value name="HIGH"> <shadow type="math_number" id="Y85T{HYBmCwW,fR4L{Y/"> <field name="NUM">255</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="`)E).r#maLTUXQg.*H~y"> <field name="VAR" id="Ch`P=wO0h3dwgm;o#AyI">saturation</field> <value name="VALUE"> <block type="math_random_int" id="Q!?(3.oaM]t#tFpC3|Pt"> <value name="FROM"> <shadow type="math_number" id="%QtJ(:N#zE1v_jN;NL{O"> <field name="NUM">0</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id="D*UHeMyi:+d#,w3EBxWR"> <field name="NUM">100</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="`p%GNgoI$FBXA7@xf[pD"> <field name="VAR" id="SJ`A30+]5x8]V,D}4N.d">hue</field> <value name="VALUE"> <block type="math_random_int" id="uN#oy+=#:a,Z-F^;~0by"> <value name="FROM"> <shadow type="math_number" id="2c_1J7h7yMsG=XRE^S!B"> <field name="NUM">0</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id="]9J{[#Dk#|;pleCY.ize"> <field name="NUM">360</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="Kq$^v^I/d8,e)K;iAs[`"> <field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field> <value name="VALUE"> <block type="math_modulo" id="caug3SbP2AJz7fV;!BLy"> <value name="DIVIDEND"> <shadow type="math_number" id="s(H?%?LoGR/-un:^f^w4"> <field name="NUM">64</field> </shadow> <block type="variables_get" id="nP$5%5l1@H;,~YgzSA]O"> <field name="VAR" id="SJ`A30+]5x8]V,D}4N.d">hue</field> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id=")s[aJ{FnF*}Zd;C:5=C7"> <field name="NUM">60</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="O[9O1Lo3CIg%{X/)e4h["> <field name="VAR" id="6o(Fc]F:U;,$wO(?.NH@">colidx</field> <value name="VALUE"> <block type="math_round" id="^^p^I;wNi.M0`-ul~yh@"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="MpWf]7Mg.M5oWe#ySGcB"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="J.+H,@dLsEU.}c,e_1zY"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number" id="N(Qv^;4fQTw6VQ)k|^y-"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="!SYV)$l8!=bSYKv=-9VK"> <field name="VAR" id="SJ`A30+]5x8]V,D}4N.d">hue</field> </block> </value> <value name="B"> <shadow type="math_number" id="Kw?p%OLg)+BX75PAf934"> <field name="NUM">60</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="i^-XG}OF0K),Kq-^9H])"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> <value name="VALUE"> <block type="math_round" id="NJzy=vM2/v-2HbAB_Zv7"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number" id="~ZDSTyvQ=-Nv{8i}C:3}"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="eJ916ibG7]{wDEj(wb-:" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="AE7ndnRy0UYFrPi?IS?N"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="2[*YU3cOzjR*|k+F/5Xk" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="Y%LW3Po0K7oX:9k*+/]+"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="t/E;)Q|%p[JcI-vJ]*`C"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="B"> <shadow type="math_number" id="Icp!@T~$Y/6OFgcOI|xQ"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="Qx|MMfbIEA4xi57(a|KP" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="@xo}rgwI:b*rbF3UsPO3"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="D8l}}D*5|kM|pi!(*q_n"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="WRbvOS.]j%G^9CUxsvbb"> <field name="VAR" id="Ch`P=wO0h3dwgm;o#AyI">saturation</field> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="6o;x1=?GsEHRSlZRCRYQ"> <field name="NUM">255</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="uX$$))kKi:POvL0(~De!"> <field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field> <value name="VALUE"> <block type="math_round" id="o2PaQ?o[H4}4|)Yx,Xmw"> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="%Mh.A=k@RwayjuMr!Kh|" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="@J`OW*p.QDl{_gkR~HPc"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="jiOZfp5M~b,F}/_B96f^" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="eIX?~^]ShELWwXD?0SnU"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="B"> <shadow type="math_number" id="nkF3G,+*[=w[MEmY7(hh"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="{1GHos0C!sA1YpC4Q+;/" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="J@CFYPOy;6qQOLHh?3V9"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="Re4}/05}}NxEg,`b/9bT" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="^/ZKy~}1}2C@I,1o^v0$"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="8|OB{fnup}Y`0QYPYTM!"> <field name="VAR" id="Ch`P=wO0h3dwgm;o#AyI">saturation</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="5zIr;6cJ0U?#Dh}SP-fb"> <field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="7tD[rC|,qGO|YtC5:_u^"> <field name="NUM">255</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="variables_set" id=":K//CGuV)=p9501ave2_"> <field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field> <value name="VALUE"> <block type="math_round" id="#k=NUXXRgctU|5-+0(z["> <field name="OP">ROUND</field> <value name="NUM"> <shadow type="math_number"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="L[+G|@BqVvN0*X~Ng9_I" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="^-GY]J|Ck)g0--8+.[?l"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="eKD_gT6!cFmOMHnQ~?f4" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="oO0tx!b}kVm)V%w0=Pn4"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="B"> <shadow type="math_number" id="u*}5Ss.Y4w|%Px4]q=z0"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="#Ma=z-Z}kWhO}z]OBC(s" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="KVA*Fl1={%}9N+R$s]/="> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="5Ng1?KYP1%nzVn+Tj#Ut" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="bN,{O[DZw6TbOY0l6X)0"> <field name="NUM">1</field> </shadow> <block type="variables_get" id=";dd$_#XKu+xb]2fogQiD"> <field name="VAR" id="Ch`P=wO0h3dwgm;o#AyI">saturation</field> </block> </value> <value name="B"> <shadow type="math_number" id="0tQc*WbtzJN*xLCAmsT9"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="q1z$N%=/gp]oR=Z=n35c" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="A?LfkxW_ti:CVnNsE,3U"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="UB-p]CD8M|f+Ue-$+?Iv"> <field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="A^0E6.OCz:*%Sw6F|N+K"> <field name="NUM">255</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="logic_switch_case" id="[/2`e$;M72t3EyXk/W4n"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="5"></mutation> <value name="CONDITION"> <block type="variables_get" id="{Tf0kynS(prv8~!|h}E+"> <field name="VAR" id="6o(Fc]F:U;,$wO(?.NH@">colidx</field> </block> </value> <value name="CASECONDITION0"> <block type="math_number" id="`$T~R1V:)#Jp36($U+jE"> <field name="NUM">0</field> </block> </value> <statement name="CASE0"> <block type="procedures_callnoreturn" id="a)MucESpm~#u,tD%2BKn"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="9+?%V+5|??]:|XkL9an:"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="agAonA6+qs@s@Niri5LC"> <field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="kgB(Db#W6J9_Q5K=,S9u"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> </block> </value> <value name="ARG3"> <block type="math_number" id="[0a@($/t:prJ9~51:gnR"> <field name="NUM">0</field> </block> </value> </block> </statement> <value name="CASECONDITION1"> <block type="math_number" id="`kLTDm@#=_q#Y}bU5?SU"> <field name="NUM">1</field> </block> </value> <statement name="CASE1"> <block type="procedures_callnoreturn" id="L6mezB,`|d?Ey^FYL%di"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="mBf.{*Q4HxY69UpPVeLb"> <field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="GT6@3DBBZ$t4@AS*kyV["> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="L{0x`J4RcZ7596X8u54="> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> </block> </value> <value name="ARG3"> <block type="math_number" id="aV3vwt}H-/aW[HHlb?*c"> <field name="NUM">0</field> </block> </value> </block> </statement> <value name="CASECONDITION2"> <block type="math_number" id="-ZLO.}{?vyO%m8~JgC.#"> <field name="NUM">2</field> </block> </value> <statement name="CASE2"> <block type="procedures_callnoreturn" id="o)?+P:ngJ3J{RRL(*{Fc"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="-GOeEp[TFw4;E2lz/~VB"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="9R2/Gove_$Cpzhz{b7sd"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="1+?cx3`Cj-zvlPY%0^|d"> <field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field> </block> </value> <value name="ARG3"> <block type="math_number" id="-E+PWSMO]K^WE5{qu/0D"> <field name="NUM">0</field> </block> </value> </block> </statement> <value name="CASECONDITION3"> <block type="math_number" id="CL_I;:55M)(?4miIxD=o"> <field name="NUM">3</field> </block> </value> <statement name="CASE3"> <block type="procedures_callnoreturn" id="lr/#i-]9kcN6w^DHR%XW"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id=";rttn$w*cet?%Zek%q]V"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="_0H)K]6kaWAYUwg#Y#-W"> <field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="cg_KsCHK[GcY%2`%9P|N"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="ARG3"> <block type="math_number" id="3Z=wU5F3]%9+*~*@$OeR"> <field name="NUM">0</field> </block> </value> </block> </statement> <value name="CASECONDITION4"> <block type="math_number" id=";q[3~,Q%{5Vn;8}Bao25"> <field name="NUM">4</field> </block> </value> <statement name="CASE4"> <block type="procedures_callnoreturn" id="z]0LB^rhUYiYJgQY^ll^"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="^AB4R({%F]}7.z(2@J1a"> <field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="3vD4vw#e-ORGzM[G/GoW"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="R)T!rwJ$Zs4tn0RWPq:T"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="ARG3"> <block type="math_number" id="1_BWPecNiz;4Pq1C-gTe"> <field name="NUM">0</field> </block> </value> </block> </statement> <value name="CASECONDITION5"> <block type="math_number" id="RY1SbQ{UMWlhI-8cYk~W"> <field name="NUM">5</field> </block> </value> <statement name="CASE5"> <block type="procedures_callnoreturn" id="[}2*[vvj4=nexw1Vx|6r"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="`AT~moSKK+]!F;YD_)DL"> <field name="VAR" id="N+S{-H34qZZ!$=r3|SqF">brightness</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="c7f|FpO:OVm#tK.b($LW"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="5%zFpK)}BO[F9A%iC51M"> <field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field> </block> </value> <value name="ARG3"> <block type="math_number" id="COJiAV{Bxf%-hQ?vAEhf"> <field name="NUM">0</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>``` [/s]
-
@asgothian sagte in Zufällige Farbe bei LED aber immer Hell:
Danke viel mal für deine Hilfe.
Ich muss zugeben das ist für mich zu hoch. Ich verstehe nicht alles in diesem Skript.
Ich glaub eigentlich, dass ich alles richtig ergänzt habe.Bei "white" und "brightness" habe ich 255 eingetragen. trotzdem kommt nur beim Weiss 100%.
Bei den Farben variiert die Helligkeit zwischen ca. 0-10%Was Mache ich falsch?
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="Q73z3!}aNHIk;s9P8Jc~">red</variable>
<variable id="?.k(,T]i~Qtqe+zczBL">green</variable> <variable id="4YpyI-wOldz^_+7a?+6a">blue</variable> <variable id="=*,Ej1+eTKyT|L/MP$?+">white</variable> <variable id="Ie2{TSCmJJ0_[6Cel!4?">brightness</variable> <variable id="Ch
P=wO0h3dwgm;o#AyI">saturation</variable>
<variable id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</variable>
<variable id="c{d|zK9J-^mydiuqy4^k">colval</variable>
<variable id="SJA30+]5x8]V,D}4N.d">hue</variable> <variable type="interval" id="interval">interval</variable> <variable id="6o(Fc]F:U;,$wO(?.NH@">colidx</variable> <variable id="/5BI_/.eYgz/x/;D$/1
">p</variable>
<variable id="t1VsF,3yY1idJ][]QEhX">q</variable>
<variable id="NuUl[0/-)M7AiHB:4=l">t</variable>
</variables>
<block type="on" id="~C#([Cujmw-UMSFQ48r" x="-613" y="-588">
<field name="OID">0_userdata.0.Effekt_2</field>
<field name="CONDITION">ne</field>
<field name="ACK_CONDITION"></field>
<statement name="STATEMENT">
<block type="controls_if" id="bM.k{{u2r|FzdX1GsOf3">
<mutation else="1"></mutation>
<value name="IF0">
<block type="on_source" id="BTgp,!1+!S6s^OR9I$4m">
<field name="ATTR">state.val</field>
</block>
</value>
<statement name="DO0">
<block type="control" id="IG9vJy#Qh8tpf^OtLcC">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.Transiton</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="C]^kg!aE(;Cv$ECxoB"> <field name="NUM">100000</field> </block> </value> <next> <block type="variables_set" id="W;d*EWil1s4vmR2!L$I?"> <field name="VAR" id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</field> <value name="VALUE"> <block type="math_number" id="0G[%7F80Gq(PHm!9AIKQ"> <field name="NUM">0</field> </block> </value> <next> <block type="timeouts_setinterval" id="^=jYiMBFu2)O[*=#:N(V"> <field name="NAME">interval</field> <field name="INTERVAL">10</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="math_change" id="cK,(R2.gg8TJgg4WcT4A"> <field name="VAR" id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</field> <value name="DELTA"> <shadow type="math_number" id="sTtoCe#~7KjID
##{~FH">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="controls_if" id="yf2f~k:X/aCWSjf$0x$"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="eC+t@[CXdKD8mrff6b}^"> <field name="OP">EQ</field> <value name="A"> <block type="math_modulo" id=")^D?B}C%F6}aESn#JjV="> <value name="DIVIDEND"> <shadow type="math_number" id="[J^!%jM73IYMZvC@#sP]"> <field name="NUM">64</field> </shadow> <block type="variables_get" id="1zb7U^/JSu+#mK
HI,f^">
<field name="VAR" id="tr44Z~f1PoZ(wY|1Kqpi">colorcounter</field>
</block>
</value>
<value name="DIVISOR">
<shadow type="math_number" id="-W}ZB|@(|sc1}0@NVOGZ">
<field name="NUM">4</field>
</shadow>
</value>
</block>
</value>
<value name="B">
<block type="math_number" id="cn:.5s%$~sQ:|KzlCXM">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="procedures_callnoreturn" id="QZot:4yrVSDa2%?}v:g"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="math_number" id="P}B$jhy8s(6tH;5Ngwbm"> <field name="NUM">0</field> </block> </value> <value name="ARG1"> <block type="math_number" id="TVU0zf
0Oc#8YoeXr,;;">
<field name="NUM">0</field>
</block>
</value>
<value name="ARG2">
<block type="math_number" id="[vomm]N-}C2]LJX~Q/lq">
<field name="NUM">0</field>
</block>
</value>
<value name="ARG3">
<block type="get_value" id="_BRn^(3aI@.ue[qEK3oz">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.LED_Garten_Hellikeit</field>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="procedures_callnoreturn" id="RtwEZdWd5Fe0?N(mhv{?">
<mutation name="RandomColor">
<arg name="brightness"></arg>
</mutation>
<value name="ARG0">
<block type="get_value" id="5d2+.|]6Siizjei3242">
<field name="ATTR">val</field>
<field name="OID">0_userdata.0.LED_Garten_Hellikeit</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</statement>
<statement name="ELSE">
<block type="control" id="QZ5~eNP5[C6HRn}#+QMw">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.Transiton</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="math_number" id="hkXuMA]1;G_T~#)}#35e">
<field name="NUM">1000</field>
</block>
</value>
<next>
<block type="timeouts_clearinterval" id="#-7CDpA3JCbGZq9I#O+%">
<field name="NAME">interval</field>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" id="aP}w|+.,@qrODu3J_B" x="-12" y="-613"> <mutation> <arg name="red" varid="Q73z3!}aNHIk;s9P8Jc~"></arg> <arg name="green" varid="?.k(,T]i~Qtqe+
zczBL"></arg>
<arg name="blue" varid="4YpyI-wOldz^_+7a?+6a"></arg>
<arg name="white" varid="=,Ej1+eTKyT|L/MP$?+"></arg>
</mutation>
<field name="NAME">SetLight</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
<block type="controls_if" id="|(53dj9G|NSRmnJ0N$,">
<mutation else="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="xqrv5|/5S8.!/~zVuYjv">
<field name="OP">GT</field>
<value name="A">
<block type="variables_get" id="lEj[KUxelNUw+Kd7F4B4">
<field name="VAR" id="=,Ej1+eTKyT|L/MP$?+">white</field>
</block>
</value>
<value name="B">
<block type="math_number" id="6P@nk$T?;=TzX^j6Acd">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="control" id="3.XivU52-3Fh3YN]ZW5f">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.white</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="a9icpq7a9/n{/Xn(QK("> <field name="VAR" id="=*,Ej1+eTKyT|L/MP$?+">white</field> </block> </value> <next> <block type="control" id=".3*trFdRI5Be|7BQr.;U"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.red</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="QWq%s{)XKc5$ev4+3vs~"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="JhMC[~Ug9;OhkDz2W9YB"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.green</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="KH/HHUM8h#hT-wk-.VCb"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="/$CBcoDDMOOmxgqvEw*4"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.blue</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="math_number" id="W]{B#5vUFMft!Pl$50!x"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <statement name="ELSE"> <block type="control" id=";d#i7d}yL3EQ5a8RW,zS"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.white</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="|GMWE
C[,m~eNR4B7N-x">
<field name="VAR" id="=,Ej1+eTKyT|L/MP$?+">white</field>
</block>
</value>
<next>
<block type="control" id="KtUr~pS4Lp-Hp-hG.D~Y">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.red</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="r,)R=$9ZmOuHoVv@Ohh+">
<field name="VAR" id="Q73z3!}aNHIk;s9P8Jc~">red</field>
</block>
</value>
<next>
<block type="control" id="Ukr6S#M+8C,/Fl[s|9eF">
<mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
<field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.green</field>
<field name="WITH_DELAY">FALSE</field>
<value name="VALUE">
<block type="variables_get" id="qtsDeN$u7kvuk90;JHWN">
<field name="VAR" id="?.k(,T]i~Qtqe+zczBL">green</field> </block> </value> <next> <block type="control" id="RNiqX?sq0nqE_%uQL=/7"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">shelly.0.SHRGBW2#0111DC#1.lights.blue</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="}RN537?p8#%yiD^orH:l"> <field name="VAR" id="4YpyI-wOldz^_+7a?+6a">blue</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> <block type="procedures_defnoreturn" id="@1oB;QW}5ERO(#FNeEX5" x="463" y="-613"> <mutation> <arg name="brightness" varid="Ie2{TSCmJJ0_[6Cel!4?"></arg> </mutation> <field name="NAME">RandomColor</field> <comment pinned="false" h="80" w="160">Describe this function...</comment> <statement name="STACK"> <block type="variables_set" id="k$aWW*;TA1Dlioteux/Z"> <field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field> <value name="VALUE"> <block type="math_constrain" id="_+NeI^i5oxukOKKm*3i?"> <value name="VALUE"> <shadow type="math_number" id="!Ne-T/WY%c%JbXtUHW.o"> <field name="NUM">50</field> </shadow> <block type="variables_get" id="@Irwy}T,7eSgXAJPDg)0"> <field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field> </block> </value> <value name="LOW"> <shadow type="math_number" id="S:z}E(db,neF86Q_tDHo"> <field name="NUM">0</field> </shadow> </value> <value name="HIGH"> <shadow type="math_number" id="Y85T{HYBmCwW,fR4L{Y/"> <field name="NUM">255</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="
)E).r#maLTUXQg.H~y">
<field name="VAR" id="ChP=wO0h3dwgm;o#AyI">saturation</field> <value name="VALUE"> <block type="math_random_int" id="Q!?(3.oaM]t#tFpC3|Pt"> <value name="FROM"> <shadow type="math_number" id="%QtJ(:N#zE1v_jN;NL{O"> <field name="NUM">0</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id="D*UHeMyi:+d#,w3EBxWR"> <field name="NUM">100</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="
p%GNgoI$FBXA7@xf[pD">
<field name="VAR" id="SJA30+]5x8]V,D}4N.d">hue</field> <value name="VALUE"> <block type="math_random_int" id="uN#oy+=#:a,Z-F^;~0by"> <value name="FROM"> <shadow type="math_number" id="2c_1J7h7yMsG=XRE^S!B"> <field name="NUM">0</field> </shadow> </value> <value name="TO"> <shadow type="math_number" id="]9J{[#Dk#|;pleCY.ize"> <field name="NUM">360</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="Kq$^v^I/d8,e)K;iAs[
">
<field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field>
<value name="VALUE">
<block type="math_modulo" id="caug3SbP2AJz7fV;!BLy">
<value name="DIVIDEND">
<shadow type="math_number" id="s(H?%?LoGR/-un:^f^w4">
<field name="NUM">64</field>
</shadow>
<block type="variables_get" id="nP$5%5l1@H;,~YgzSA]O">
<field name="VAR" id="SJA30+]5x8]V,D}4N.d">hue</field> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id=")s[aJ{FnF*}Zd;C:5=C7"> <field name="NUM">60</field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="O[9O1Lo3CIg%{X/)e4h["> <field name="VAR" id="6o(Fc]F:U;,$wO(?.NH@">colidx</field> <value name="VALUE"> <block type="math_round" id="^^p^I;wNi.M0
-ul~yh@">
<field name="OP">ROUNDDOWN</field>
<value name="NUM">
<shadow type="math_number" id="MpWf]7Mg.M5oWe#ySGcB">
<field name="NUM">3.1</field>
</shadow>
<block type="math_arithmetic" id="J.+H,@dLsEU.}c,e_1zY">
<field name="OP">DIVIDE</field>
<value name="A">
<shadow type="math_number" id="N(Qv^;4fQTw6VQ)k|^y-">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="!SYV)$l8!=bSYKv=-9VK">
<field name="VAR" id="SJA30+]5x8]V,D}4N.d">hue</field> </block> </value> <value name="B"> <shadow type="math_number" id="Kw?p%OLg)+BX75PAf934"> <field name="NUM">60</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="i^-XG}OF0K),Kq-^9H])"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1
">p</field>
<value name="VALUE">
<block type="math_round" id="NJzy=vM2/v-2HbAB_Zv7">
<field name="OP">ROUND</field>
<value name="NUM">
<shadow type="math_number" id="~ZDSTyvQ=-Nv{8i}C:3}">
<field name="NUM">3.1</field>
</shadow>
<block type="math_arithmetic" id="eJ916ibG7]{wDEj(wb-:" inline="false">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="AE7ndnRy0UYFrPi?IS?N">
<field name="NUM">1</field>
</shadow>
<block type="math_arithmetic" id="2[YU3cOzjR|k+F/5Xk" inline="false">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="Y%LW3Po0K7oX:9k+/]+">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="t/E;)Q|%p[JcI-vJ]C"> <field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field> </block> </value> <value name="B"> <shadow type="math_number" id="Icp!@T~$Y/6OFgcOI|xQ"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="Qx|MMfbIEA4xi57(a|KP" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="@xo}rgwI:b*rbF3UsPO3"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="D8l}}D*5|kM|pi!(*q_n"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="WRbvOS.]j%G^9CUxsvbb"> <field name="VAR" id="Ch
P=wO0h3dwgm;o#AyI">saturation</field>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id="6o;x1=?GsEHRSlZRCRYQ">
<field name="NUM">255</field>
</shadow>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="uX$$))kKi:POvL0(~De!">
<field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field>
<value name="VALUE">
<block type="math_round" id="o2PaQ?o[H4}4|)Yx,Xmw">
<field name="OP">ROUND</field>
<value name="NUM">
<shadow type="math_number">
<field name="NUM">3.1</field>
</shadow>
<block type="math_arithmetic" id="%Mh.A=k@RwayjuMr!Kh|" inline="false">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="@JOW*p.QDl{_gkR~HPc"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="jiOZfp5M~b,F}/_B96f^" inline="false"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="eIX?~^]ShELWwXD?0SnU"> <field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field> </block> </value> <value name="B"> <shadow type="math_number" id="nkF3G,+*[=w[MEmY7(hh"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="{1GHos0C!sA1YpC4Q+;/" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="J@CFYPOy;6qQOLHh?3V9"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="Re4}/05}}NxEg,
b/9bT" inline="false">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="^/ZKy~}1}2C@I,1o^v0$">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="8|OB{fnup}Y0QYPYTM!"> <field name="VAR" id="Ch
P=wO0h3dwgm;o#AyI">saturation</field>
</block>
</value>
<value name="B">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="5zIr;6cJ0U?#Dh}SP-fb">
<field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id="7tD[rC|,qGO|YtC5:u^">
<field name="NUM">255</field>
</shadow>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id=":K//CGuV)=p9501ave2">
<field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field>
<value name="VALUE">
<block type="math_round" id="#k=NUXXRgctU|5-+0(z[">
<field name="OP">ROUND</field>
<value name="NUM">
<shadow type="math_number">
<field name="NUM">3.1</field>
</shadow>
<block type="math_arithmetic" id="L[+G|@BqVvN0X~Ng9_I" inline="false">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="^-GY]J|Ck)g0--8+.[?l">
<field name="NUM">1</field>
</shadow>
<block type="math_arithmetic" id="eKD_gT6!cFmOMHnQ~?f4" inline="false">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id="oO0tx!b}kVm)V%w0=Pn4">
<field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="u*}5Ss.Y4w|%Px4]q=z0">
<field name="NUM">1</field>
</shadow>
<block type="math_arithmetic" id="#Ma=z-Z}kWhO}z]OBC(s" inline="false">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="KVAFl1={%}9N+R$s]/=">
<field name="NUM">1</field>
</shadow>
</value>
<value name="B">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
<block type="math_arithmetic" id="5Ng1?KYP1%nzVn+Tj#Ut" inline="false">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="bN,{O[DZw6TbOY0l6X)0">
<field name="NUM">1</field>
</shadow>
<block type="variables_get" id=";dd$#XKu+xb]2fogQiD">
<field name="VAR" id="ChP=wO0h3dwgm;o#AyI">saturation</field> </block> </value> <value name="B"> <shadow type="math_number" id="0tQc*WbtzJN*xLCAmsT9"> <field name="NUM">1</field> </shadow> <block type="math_arithmetic" id="q1z$N%=/gp]oR=Z=n35c" inline="false"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="A?LfkxW_ti:CVnNsE,3U"> <field name="NUM">1</field> </shadow> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="UB-p]CD8M|f+Ue-$+?Iv"> <field name="VAR" id="c{d|zK9J-^mydiuqy4^k">colval</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </value> <value name="B"> <shadow type="math_number" id="A^0E6.OCz:*%Sw6F|N+K"> <field name="NUM">255</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="logic_switch_case" id="[/2
e$;M72t3EyXk/W4n">
<mutation xmlns="http://www.w3.org/1999/xhtml" case="5"></mutation>
<value name="CONDITION">
<block type="variables_get" id="{Tf0kynS(prv8~!|h}E+">
<field name="VAR" id="6o(Fc]F:U;,$wO(?.NH@">colidx</field>
</block>
</value>
<value name="CASECONDITION0">
<block type="math_number" id="$T~R1V:)#Jp36($U+jE"> <field name="NUM">0</field> </block> </value> <statement name="CASE0"> <block type="procedures_callnoreturn" id="a)MucESpm~#u,tD%2BKn"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="9+?%V+5|??]:|XkL9an:"> <field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="agAonA6+qs@s@Niri5LC"> <field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="kgB(Db#W6J9_Q5K=,S9u"> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1
">p</field>
</block>
</value>
<value name="ARG3">
<block type="math_number" id="[0a@($/t:prJ9~51:gnR">
<field name="NUM">0</field>
</block>
</value>
</block>
</statement>
<value name="CASECONDITION1">
<block type="math_number" id="kLTDm@#=_q#Y}bU5?SU"> <field name="NUM">1</field> </block> </value> <statement name="CASE1"> <block type="procedures_callnoreturn" id="L6mezB,
|d?Ey^FYL%di">
<mutation name="SetLight">
<arg name="red"></arg>
<arg name="green"></arg>
<arg name="blue"></arg>
<arg name="white"></arg>
</mutation>
<value name="ARG0">
<block type="variables_get" id="mBf.{Q4HxY69UpPVeLb">
<field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field>
</block>
</value>
<value name="ARG1">
<block type="variables_get" id="GT6@3DBBZ$t4@ASkyV[">
<field name="VAR" id="Ie2{TSCmJJ0[6Cel!4?">brightness</field>
</block>
</value>
<value name="ARG2">
<block type="variables_get" id="L{0xJ4RcZ7596X8u54="> <field name="VAR" id="/5BI_/.eYgz/x/;D$/1
">p</field>
</block>
</value>
<value name="ARG3">
<block type="math_number" id="aV3vwt}H-/aW[HHlb?c">
<field name="NUM">0</field>
</block>
</value>
</block>
</statement>
<value name="CASECONDITION2">
<block type="math_number" id="-ZLO.}{?vyO%m8~JgC.#">
<field name="NUM">2</field>
</block>
</value>
<statement name="CASE2">
<block type="procedures_callnoreturn" id="o)?+P:ngJ3J{RRL({Fc">
<mutation name="SetLight">
<arg name="red"></arg>
<arg name="green"></arg>
<arg name="blue"></arg>
<arg name="white"></arg>
</mutation>
<value name="ARG0">
<block type="variables_get" id="-GOeEp[TFw4;E2lz/~VB">
<field name="VAR" id="/5BI_/.eYgz/x/;D$/1">p</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="9R2/Gove_$Cpzhz{b7sd"> <field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="1+?cx3
Cj-zvlPY%0^|d">
<field name="VAR" id="NuUl[0/-)M7AiHB:_4=l">t</field>
</block>
</value>
<value name="ARG3">
<block type="math_number" id="-E+PWSMO]K^WE5{qu/0D">
<field name="NUM">0</field>
</block>
</value>
</block>
</statement>
<value name="CASECONDITION3">
<block type="math_number" id="CL_I;:55M)(?4miIxD=o">
<field name="NUM">3</field>
</block>
</value>
<statement name="CASE3">
<block type="procedures_callnoreturn" id="lr/#i-]9kcN6w^DHR%XW">
<mutation name="SetLight">
<arg name="red"></arg>
<arg name="green"></arg>
<arg name="blue"></arg>
<arg name="white"></arg>
</mutation>
<value name="ARG0">
<block type="variables_get" id=";rttn$wcet?%Zek%q]V">
<field name="VAR" id="/5BI_/.eYgz/x/;D$/1">p</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="_0H)K]6kaWAYUwg#Y#-W"> <field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="cg_KsCHK[GcY%2
%9P|N">
<field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field>
</block>
</value>
<value name="ARG3">
<block type="math_number" id="3Z=wU5F3]%9+~@$OeR">
<field name="NUM">0</field>
</block>
</value>
</block>
</statement>
<value name="CASECONDITION4">
<block type="math_number" id=";q[3~,Q%{5Vn;8}Bao25">
<field name="NUM">4</field>
</block>
</value>
<statement name="CASE4">
<block type="procedures_callnoreturn" id="z]0LB^rhUYiYJgQY^ll^">
<mutation name="SetLight">
<arg name="red"></arg>
<arg name="green"></arg>
<arg name="blue"></arg>
<arg name="white"></arg>
</mutation>
<value name="ARG0">
<block type="variables_get" id="^AB4R({%F]}7.z(2@J1a">
<field name="VAR" id="NuUl[0/-)M7AiHB:4=l">t</field>
</block>
</value>
<value name="ARG1">
<block type="variables_get" id="3vD4vw#e-ORGzM[G/GoW">
<field name="VAR" id="/5BI/.eYgz/x/;D$/1">p</field> </block> </value> <value name="ARG2"> <block type="variables_get" id="R)T!rwJ$Zs4tn0RWPq:T"> <field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field> </block> </value> <value name="ARG3"> <block type="math_number" id="1_BWPecNiz;4Pq1C-gTe"> <field name="NUM">0</field> </block> </value> </block> </statement> <value name="CASECONDITION5"> <block type="math_number" id="RY1SbQ{UMWlhI-8cYk~W"> <field name="NUM">5</field> </block> </value> <statement name="CASE5"> <block type="procedures_callnoreturn" id="[}2*[vvj4=nexw1Vx|6r"> <mutation name="SetLight"> <arg name="red"></arg> <arg name="green"></arg> <arg name="blue"></arg> <arg name="white"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="
AT~moSKK+]!F;YD_)DL">
<field name="VAR" id="Ie2{TSCmJJ0_[6Cel!4?">brightness</field>
</block>
</value>
<value name="ARG1">
<block type="variables_get" id="c7f|FpO:OVm#tK.b($LW">
<field name="VAR" id="/5BI_/.eYgz/x/;D$/1`">p</field>
</block>
</value>
<value name="ARG2">
<block type="variables_get" id="5%zFpK)}BO[F9A%iC51M">
<field name="VAR" id="t1VsF,3yY1idJ][]QEhX">q</field>
</block>
</value>
<value name="ARG3">
<block type="math_number" id="COJiAV{Bxf%-hQ?vAEhf">
<field name="NUM">0</field>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>
-
@bumm du musst zum Ansteuern der Helligkeit einen eigenen datenpunkt anlegen. Du darfst NICHT den von der Lampe selber nehmen.
A.
-
Ich habe einen Eigenen Datenpunkt gemacht.
Habe den Selben für beide verwendet. Das sollte ja kein Problem sein, oder? -
Ich habe gesehen das mein Shelly selber hue, gain uns saturation hat.
Ich glaub ich muss mit dem arbeiten. Habe mal manuell daran rumgespielt. das schein zu funktionieren. jetzt muss ich nur noch ein Skript hin bekommen. -
@bumm
Dadurch wird es sehr einfach, das stimmt. Du kannst einfach direkt über diese Punkte arbeiten.Nur der Vollständigkeit halber noch die Korrektur meines Skriptes: Ich habe aus versehen die alte Version der Funktion RandomColor gepostet. Der erste Block (set brightness to colval constrained with 0 and 255) muss weg. Dann sollte es gehen.
Ansonsten kannst du es einfach so probieren:
A.
-
Danke nochmals für die Hilfe
Ich habe gestern selber gebastelt und es funktioniert.
Wie ich dich kenne sagst du mir aber das ist völlig falsch aufgebautDarum werde ich gerne deine Version versuchen.
Schönes Wochenende
Grüsse Stefan
-
@bumm sagte in Zufällige Farbe bei LED aber immer Hell:
Wie ich dich kenne sagst du mir aber das ist völlig falsch aufgebaut
Nein, das ist es nicht. Die entscheidenden Punkte sind sauber. Du nutzt ein synchrones Script mit “Pause” Befehlen an Stelle des Intervalls. Wichtig ist das du sicher stellst das keine Endlosschleife drin ist - das hast du getan.
A.