Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Blockly Schleife am GPIO Pin vom RPI.

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    3.2k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.1k

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.4k

Blockly Schleife am GPIO Pin vom RPI.

Scheduled Pinned Locked Moved Skripten / Logik
19 Posts 3 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AlCalzoneA Offline
    AlCalzoneA Offline
    AlCalzone
    Developer
    wrote on last edited by
    #4

    Wie gesagt, keine Schleife, sondern ein Intervall (Reiter Timeouts)! Die Schleife sorgt dafür, dass du sofort 30x ausschaltest und in 1s 30x einschaltest.

    Falsch genutzt (und das werden sie in 95% der Fälle in diesem Forum) sorgt ne Schleife dafür, dass dein ioBroker/Host sich aufhängt.

    Ich nutze selber kein Blockly (und habe gerade kein Zugriff auf ioBroker zum Testen), aber ich würde mal im Reiter "Variable" nach Variablen suchen und im Reiter "Datum und Zeit" nach einem Block fürs aktuelle Datum.

    Edit: Diese Blöcke sehen ganz gut aus: http://forum.iobroker.net/viewtopic.php … 74#p119274

    Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

    1 Reply Last reply
    0
    • K Offline
      K Offline
      knopers1
      wrote on last edited by
      #5

      Danke AlCalzone für deine Mühe…

      Habe erfolglos versucht einiges nachzubauen. Das Blinken alleine klappte wohl mit Intervalle. Bin aber daran gescheitert das Blinken abzustellen nach voreingestellter Zeit. Habe den halben Tag erfolglos probiert. Selbst die Beispiele haben mir nicht weiter geholfen. Ehh, bin sauer :evil:

      Wenigstens funktioniert das Schalten der GPIO EIN/Ausgänge vom RPI... Habe bis dato nur die Arduinos uns die ESPs dafür verwendet und die GPIOs vom Rpi warem mir eher fremd.

      HP Microserver Gen8, RPI-4, IoBroker,

      1 Reply Last reply
      0
      • AlCalzoneA Offline
        AlCalzoneA Offline
        AlCalzone
        Developer
        wrote on last edited by
        #6

        Ich kann’s heute Abend mal mit blockly probieren, wenn kein anderer schneller ist

        Posts mir bitte mal was du schon hast

        Gesendet von unterwegs

        Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

        1 Reply Last reply
        0
        • K Offline
          K Offline
          knopers1
          wrote on last edited by
          #7

          Danke,

          das Blinken funktioniert. (Siehe Bild)

          Jetzt brauche ich noch eine Art Timer, was das Blinken der LED nach voreingestellter Zeit wieder aus macht.
          1526_unbenannt.png

          HP Microserver Gen8, RPI-4, IoBroker,

          1 Reply Last reply
          0
          • rantanplanR Offline
            rantanplanR Offline
            rantanplan
            wrote on last edited by
            #8

            Hallo knopers1

            Probiere es mal so.
            147_beispiel.png

            Export:

            ! ````
            <xml xmlns="http://www.w3.org/1999/xhtml"><block type="on" id=";q/.LTbkOqHb5{2bWJS8" x="88" y="37"><field name="OID">Object ID</field>
            <field name="CONDITION">true</field>

            <statement name="STATEMENT"><block type="variables_set" id="8)*UM%ssIY4]cl?JG{RJ"><field name="VAR">zaehler</field>
                <value name="VALUE"><block type="math_number" id="]ef5SYV26!4mP{{{-l^^"><field name="NUM">0</field></block></value> 
                <next><block type="comment" id=";dB-iJCvrFX#Nti|VduR"><field name="COMMENT">jede Sekunde ausführen</field>
                    <next><block type="schedule_create" id="7YW(GFC|3w8At73kH9Ll"><field name="NAME">schedule</field>
                        <value name="SCHEDULE"><shadow type="field_cron" id="iCv]P/jck;daB8PHsv:N"><field name="CRON">* * * * * *</field></shadow></value> 
                        <statement name="STATEMENT"><block type="comment" id="h4gP}9C#%.[%2y=kbF`]"><field name="COMMENT">10x blinken</field>
                            <next><block type="math_change" id="DoL@{K#@7,~o##`!l^+}"><field name="VAR">zaehler</field>
                                <value name="DELTA"><shadow type="math_number" id="dCStYpx.|_{]0akWy}lp"><field name="NUM">1</field></shadow></value> 
                                <next><block type="controls_if" id="*qr+b2)!djax20P_:#t."><mutation else="1"></mutation>
                                    <value name="IF0"><block type="logic_compare" id="JH[#Spr1hlZ;6jM5pQt."><field name="OP">GT</field>
                                        <value name="A"><block type="variables_get" id="/9-D?8rl),9h^`HKdVP("><field name="VAR">zaehler</field></block></value> 
                                        <value name="B"><block type="math_number" id=")3MuM(dan%|N6VLx(D4~"><field name="NUM">10</field></block></value></block></value> 
                                    <statement name="DO0"><block type="schedule_clear" id="A:#M8^UIxz5mF+m12%!`"><field name="NAME">schedule</field></block></statement> 
                                    <statement name="ELSE"><block type="comment" id="4?c%{LmnK7`}3VRAc2]3"><field name="COMMENT">einschalten</field>
                                        <next><block type="control" id="jU:X1l:_T?rouW=h+vHA"><mutation delay_input="false"></mutation>
                                            <field name="OID">Object ID</field>
                                            <field name="WITH_DELAY">FALSE</field>
                                            <value name="VALUE"><block type="logic_boolean" id="J!]au?B|bA]l@C;DG/2o"><field name="BOOL">TRUE</field></block></value> 
                                            <next><block type="comment" id="0Sqs}3}^}Mm%Zd14!hn="><field name="COMMENT">ausschalten</field>
                                                <next><block type="comment" id="PL12o02P`Tl7~17/(1*`"><field name="COMMENT">Verzögerung kleiner 1 Sekunde</field>
                                                    <next><block type="control" id="8gj)ckTtkjj+p.K8t|T_"><mutation delay_input="true"></mutation>
                                                        <field name="OID">Object ID</field>
                                                        <field name="WITH_DELAY">TRUE</field>
                                                        <field name="DELAY_MS">500</field>
                                                        <field name="UNIT">ms</field>
                                                        <field name="CLEAR_RUNNING">FALSE</field>
                                                        <value name="VALUE"><block type="logic_boolean" id="SQ}g@Kp`vB:S*^TU%ze3"><field name="BOOL">FALSE</field></block></value></block></next></block></next></block></next></block></next></block></statement></block></next></block></next></block></statement></block></next></block></next></block></statement></block></xml> 
            

            ! Grüße
            ! ````

            Rantanplan

            CCU3 / MS Server 2019(VM) / Scripten mit Blockly

            1 Reply Last reply
            0
            • K Offline
              K Offline
              knopers1
              wrote on last edited by
              #9

              @rantaplan

              bist für mich der Blockly Gott :)

              Ich teste es mal sobald ich zu Hause bin und berichte….

              HP Microserver Gen8, RPI-4, IoBroker,

              1 Reply Last reply
              0
              • AlCalzoneA Offline
                AlCalzoneA Offline
                AlCalzone
                Developer
                wrote on last edited by
                #10

                Das ist in etwa das was ich vorgeschlagen hab, nur mit Zähler statt Uhrzeit und Schedule statt Intervall ;)

                Würde allerdings tatsächlich ein Intervall verwenden, da das etwas weniger Overhead hat.

                Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

                1 Reply Last reply
                0
                • rantanplanR Offline
                  rantanplanR Offline
                  rantanplan
                  wrote on last edited by
                  #11

                  @AlCalzone:

                  Das ist in etwa das was ich vorgeschlagen hab, nur mit Zähler statt Uhrzeit und Schedule statt Intervall ;)

                  Würde allerdings tatsächlich ein Intervall verwenden, da das etwas weniger Overhead hat. `
                  Ja, hast Recht.

                  Ich war gerade mit dem Schedule am "spielen" und hatte da die Idee.

                  Und warum einfach wenn es auch kompliziert geht :D :D

                  Grüße

                  Rantanplan

                  CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                  1 Reply Last reply
                  0
                  • rantanplanR Offline
                    rantanplanR Offline
                    rantanplan
                    wrote on last edited by
                    #12

                    Hier die einfachere (und bessere :oops: ) Version von AlCalzone.
                    147_beispiel.png

                    Export:

                    ! ````
                    <xml xmlns="http://www.w3.org/1999/xhtml"><block type="on" id=";q/.LTbkOqHb5{2bWJS8" x="38" y="-13"><field name="OID">Object ID</field>
                    <field name="CONDITION">true</field>

                    <statement name="STATEMENT"><block type="variables_set" id="8)*UM%ssIY4]cl?JG{RJ"><field name="VAR">zaehler</field>
                        <value name="VALUE"><block type="math_number" id="]ef5SYV26!4mP{{{-l^^"><field name="NUM">0</field></block></value> 
                        <next><block type="comment" id=";dB-iJCvrFX#Nti|VduR"><field name="COMMENT">Intervall starten</field>
                            <next><block type="timeouts_setinterval" id="HWQqXWP|VsT+Fz*Ab+|@"><field name="NAME">Intervall</field>
                                <field name="INTERVAL">1000</field>
                                <field name="UNIT">ms</field>
                                <statement name="STATEMENT"><block type="comment" id="h4gP}9C#%.[%2y=kbF`]"><field name="COMMENT">10x blinken</field>
                                    <next><block type="math_change" id="DoL@{K#@7,~o##`!l^+}"><field name="VAR">zaehler</field>
                                        <value name="DELTA"><shadow type="math_number" id="dCStYpx.|_{]0akWy}lp"><field name="NUM">1</field></shadow></value> 
                                        <next><block type="controls_if" id="*qr+b2)!djax20P_:#t."><mutation else="1"></mutation>
                                            <value name="IF0"><block type="logic_compare" id="JH[#Spr1hlZ;6jM5pQt."><field name="OP">GT</field>
                                                <value name="A"><block type="variables_get" id="/9-D?8rl),9h^`HKdVP("><field name="VAR">zaehler</field></block></value> 
                                                <value name="B"><block type="math_number" id=")3MuM(dan%|N6VLx(D4~"><field name="NUM">10</field></block></value></block></value> 
                                            <statement name="DO0"><block type="timeouts_clearinterval" id="H-qSL3prj3YmbW5`kn+w"><field name="NAME">Intervall</field></block></statement> 
                                            <statement name="ELSE"><block type="comment" id="4?c%{LmnK7`}3VRAc2]3"><field name="COMMENT">einschalten</field>
                                                <next><block type="control" id="jU:X1l:_T?rouW=h+vHA"><mutation delay_input="false"></mutation>
                                                    <field name="OID">Object ID</field>
                                                    <field name="WITH_DELAY">FALSE</field>
                                                    <value name="VALUE"><block type="logic_boolean" id="J!]au?B|bA]l@C;DG/2o"><field name="BOOL">TRUE</field></block></value> 
                                                    <next><block type="comment" id="0Sqs}3}^}Mm%Zd14!hn="><field name="COMMENT">ausschalten</field>
                                                        <next><block type="comment" id="PL12o02P`Tl7~17/(1*`"><field name="COMMENT">Verzögerung kleiner Intervall Zeit!!!</field>
                                                            <next><block type="control" id="8gj)ckTtkjj+p.K8t|T_"><mutation delay_input="true"></mutation>
                                                                <field name="OID">Object ID</field>
                                                                <field name="WITH_DELAY">TRUE</field>
                                                                <field name="DELAY_MS">500</field>
                                                                <field name="UNIT">ms</field>
                                                                <field name="CLEAR_RUNNING">FALSE</field>
                                                                <value name="VALUE"><block type="logic_boolean" id="SQ}g@Kp`vB:S*^TU%ze3"><field name="BOOL">FALSE</field></block></value></block></next></block></next></block></next></block></next></block></statement></block></next></block></next></block></statement></block></next></block></next></block></statement></block></xml> 
                    

                    ! ````

                    Grüße

                    Rantanplan

                    CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      knopers1
                      wrote on last edited by
                      #13

                      kann später ausprobieren und werde berichten…. Danke Euch beiden dafür!

                      HP Microserver Gen8, RPI-4, IoBroker,

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        knopers1
                        wrote on last edited by
                        #14

                        wie vermutet, es geht….. Leider prellt mein Taster ein wenig. Dies hat zu folge, dass die Intervalle zu oft ausgelöst werden. Dann blinkt es nur noch etweder zu kurz, oder ungleichmäßig... Für den Schalterbetrieb wird hierbei ein Pulldown benötigt. Aber wenn ich ein BM als trigger nehme, sollte es keine Probleme bereiten.

                        HP Microserver Gen8, RPI-4, IoBroker,

                        1 Reply Last reply
                        0
                        • AlCalzoneA Offline
                          AlCalzoneA Offline
                          AlCalzone
                          Developer
                          wrote on last edited by
                          #15

                          @knopers1:

                          wie vermutet, es geht….. Leider prellt mein Taster ein wenig. Dies hat zu folge, dass die Intervalle zu oft ausgelöst werden. `
                          Ein "stoppe Intervall" zu Beginn des Triggers könnte das beheben. Wobei dann der Zähler zu oft zurückgesetzt wird. Sauber wäre:

                          Wenn Intervall NICHT läuft, dann:

                          • setze Zähler auf 0

                          • starte Intervall

                          Aber kein Plan wie das mit Klickibunti geht, das kann ich nur in Textform ;)

                          Warum `sudo` böse ist: https://forum.iobroker.net/post/17109

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            knopers1
                            wrote on last edited by
                            #16

                            Wo meinst Du es genau? Soll ich es oben drauf packen? :lol: :lol: :mrgreen: :mrgreen: :mrgreen: hehe, gut gelacht hab ich…...

                            HP Microserver Gen8, RPI-4, IoBroker,

                            1 Reply Last reply
                            0
                            • rantanplanR Offline
                              rantanplanR Offline
                              rantanplan
                              wrote on last edited by
                              #17

                              @AlCalzone:

                              Wenn Intervall NICHT läuft, dann:

                              • setze Zähler auf 0

                              • starte Intervall `
                                Bei "KlickiBunti" geht das leider (noch) nicht. ;)

                              "KlickiBunti-Leute" müssen da schon mal nachdenken. :D

                              So sollte die Taste entprellt werden.
                              147_beispiel.png

                              Export:

                              ! ````
                              <xml xmlns="http://www.w3.org/1999/xhtml"><block type="comment" id="#{k%e[{to01DQ.UohMC" x="37" y="-62"><field name="COMMENT">Initialisierung bei Scriptstart</field> <next><block type="variables_set" id="cY|8twokXAk|tCx52]m"><field name="VAR">zaehler</field>
                              <value name="VALUE"><block type="math_number" id="~hs.|8i{sszJUGJb!~Sg"><field name="NUM">0</field></block></value>
                              <next><block type="variables_set" id="(=M+iT3_#LPC4PRUFOj"><field name="VAR">TimerOn</field> <value name="VALUE"><block type="logic_boolean" id="LN,C1@WJT0|UKvUNmWB"><field name="BOOL">FALSE</field></block></value>
                              <next><block type="comment" id="Bvitj`3,WuzK:vgIZwr{"><field name="COMMENT">Triggern</field>
                              <next><block type="on" id=";q/.LTbkOqHb5{2bWJS8"><field name="OID">Object ID</field>
                              <field name="CONDITION">true</field>

                                              <statement name="STATEMENT"><block type="controls_if" id="/:PVKStC^F(xsisHri7k"><value name="IF0"><block type="logic_compare" id="?I-0QT~eAMMB6h.@06o4"><field name="OP">EQ</field>
                                                      <value name="A"><block type="variables_get" id="6Vye,dz+3CM#t#}Q,9MG"><field name="VAR">TimerOn</field></block></value> 
                                                      <value name="B"><block type="logic_boolean" id="]D},%3E65Tf%jDYJC3!x"><field name="BOOL">FALSE</field></block></value></block></value> 
                                                  <statement name="DO0"><block type="comment" id=";dB-iJCvrFX#Nti|VduR"><field name="COMMENT">Intervall starten</field>
                                                      <next><block type="variables_set" id="XMkaY]a71BOr=x[%kJPo"><field name="VAR">TimerOn</field>
                                                          <value name="VALUE"><block type="logic_boolean" id="R?wJI^Ea|BLUFdk[?`PB"><field name="BOOL">TRUE</field></block></value> 
                                                          <next><block type="timeouts_setinterval" id="HWQqXWP|VsT+Fz*Ab+|@"><field name="NAME">Intervall</field>
                                                              <field name="INTERVAL">1000</field>
                                                              <field name="UNIT">ms</field>
                                                              <statement name="STATEMENT"><block type="comment" id="h4gP}9C#%.[%2y=kbF`]"><field name="COMMENT">10x blinken</field>
                                                                  <next><block type="math_change" id="DoL@{K#@7,~o##`!l^+}"><field name="VAR">zaehler</field>
                                                                      <value name="DELTA"><shadow type="math_number" id="dCStYpx.|_{]0akWy}lp"><field name="NUM">1</field></shadow></value> 
                                                                      <next><block type="controls_if" id="*qr+b2)!djax20P_:#t."><mutation else="1"></mutation>
                                                                          <value name="IF0"><block type="logic_compare" id="JH[#Spr1hlZ;6jM5pQt."><field name="OP">GT</field>
                                                                              <value name="A"><block type="variables_get" id="/9-D?8rl),9h^`HKdVP("><field name="VAR">zaehler</field></block></value> 
                                                                              <value name="B"><block type="math_number" id=")3MuM(dan%|N6VLx(D4~"><field name="NUM">10</field></block></value></block></value> 
                                                                          <statement name="DO0"><block type="variables_set" id=",NvX2rG]TWUe?lDK#7?f"><field name="VAR">zaehler</field>
                                                                              <value name="VALUE"><block type="math_number" id="J12u.l:9VqNV+A@%LrH8"><field name="NUM">0</field></block></value> 
                                                                              <next><block type="variables_set" id="FAv+kZB=iiO_HMV2ADXi"><field name="VAR">TimerOn</field>
                                                                                  <value name="VALUE"><block type="logic_boolean" id=",}mPhyQ=*S=vmo1n!w`k"><field name="BOOL">FALSE</field></block></value> 
                                                                                  <next><block type="timeouts_clearinterval" id="H-qSL3prj3YmbW5`kn+w"><field name="NAME">Intervall</field></block></next></block></next></block></statement> 
                                                                          <statement name="ELSE"><block type="comment" id="4?c%{LmnK7`}3VRAc2]3"><field name="COMMENT">einschalten</field>
                                                                              <next><block type="control" id="jU:X1l:_T?rouW=h+vHA"><mutation delay_input="false"></mutation>
                                                                                  <field name="OID">Object ID</field>
                                                                                  <field name="WITH_DELAY">FALSE</field>
                                                                                  <value name="VALUE"><block type="logic_boolean" id="J!]au?B|bA]l@C;DG/2o"><field name="BOOL">TRUE</field></block></value> 
                                                                                  <next><block type="comment" id="0Sqs}3}^}Mm%Zd14!hn="><field name="COMMENT">ausschalten</field>
                                                                                      <next><block type="comment" id="PL12o02P`Tl7~17/(1*`"><field name="COMMENT">Verzögerung kleiner Intervall Zeit!!!</field>
                                                                                          <next><block type="control" id="8gj)ckTtkjj+p.K8t|T_"><mutation delay_input="true"></mutation>
                                                                                              <field name="OID">Object ID</field>
                                                                                              <field name="WITH_DELAY">TRUE</field>
                                                                                              <field name="DELAY_MS">500</field>
                                                                                              <field name="UNIT">ms</field>
                                                                                              <field name="CLEAR_RUNNING">FALSE</field>
                                                                                              <value name="VALUE"><block type="logic_boolean" id="SQ}g@Kp`vB:S*^TU%ze3"><field name="BOOL">FALSE</field></block></value></block></next></block></next></block></next></block></next></block></statement></block></next></block></next></block></statement></block></next></block></next></block></statement></block></statement></block></next></block></next></block></next></block></next></block></xml> 
                              

                              ! ````

                              Grüße

                              Rantanplan

                              CCU3 / MS Server 2019(VM) / Scripten mit Blockly

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                knopers1
                                wrote on last edited by
                                #18

                                bin gespannt :mrgreen:

                                ich berichte später ob es geht. :)

                                HP Microserver Gen8, RPI-4, IoBroker,

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  knopers1
                                  wrote on last edited by
                                  #19

                                  @rantaplan

                                  DANKE, läuft Top ohne wenn und aber….

                                  HP Microserver Gen8, RPI-4, IoBroker,

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate

                                  645

                                  Online

                                  32.7k

                                  Users

                                  82.3k

                                  Topics

                                  1.3m

                                  Posts
                                  Community
                                  Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                  ioBroker Community 2014-2025
                                  logo
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Home
                                  • Recent
                                  • Tags
                                  • Unread 0
                                  • Categories
                                  • Unreplied
                                  • Popular
                                  • GitHub
                                  • Docu
                                  • Hilfe