Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. (erledigt)Hilfe bei Bit operation and / or

    NEWS

    • ioBroker goes Matter ... Matter Adapter in Stable

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    (erledigt)Hilfe bei Bit operation and / or

    This topic has been deleted. Only users with topic management privileges can see it.
    • ubecker
      ubecker last edited by ubecker

      Hallo,
      brauch mal wieder eure hilfe bei einer Bitoperation

      bit  7 6 5 4 3 2 1 0  
            x x x x x 1 x 1  |
            x x x x x 0 x 1  |  Ergebis immer true
            x x x x x 1 x 0  |
      	
            x x x x x 0 x 0  |  false
      	
      a = inputwert & 4
      b = inputwert & 1
      c = a + b
      if c = 0 dann false else true
      
      
      

      wie schreibt man das vernünftig?

      Asgothian 1 Reply Last reply Reply Quote 0
      • Asgothian
        Asgothian Developer @ubecker last edited by Asgothian

        @ubecker
        Mindestens ein Bit korrekt gesetzt

        Result = (inputwert & 5) != 0
        

        Alle Bits korrekt gesetzt

        Result = (inputwert & 5) == 5
        
        ubecker 1 Reply Last reply Reply Quote 0
        • ubecker
          ubecker @Asgothian last edited by

          @asgothian said in Hilfe bei Bit operation and / or:

          Result = (inputwert & 5) != 0

          danke, das hab ich gesucht.

          haus-automatisierung 1 Reply Last reply Reply Quote 0
          • haus-automatisierung
            haus-automatisierung Developer Most Active @ubecker last edited by

            @ubecker Noch ein Thema dazu? Was hatte Dir denn hier bei den ganzen Beispielen gefehlt? https://forum.iobroker.net/topic/73495/erledigt-bitweise-and-in-blockly

            ubecker 1 Reply Last reply Reply Quote 0
            • ubecker
              ubecker @haus-automatisierung last edited by

              @haus-automatisierung da hast du ja Recht, im Prinzip ist da alles. Mein Problem ist das ich die Syntax von JS noch nicht drin habe und mich damit schwer tue. Manchmal aber auch in Umwegen denke. Ich habe erst im November letztn Jahr mit IOBroker angefangen und da dann erste mal mit JS zu tun gehabt habe. Mein Schwerpunkt ist Hardware und nicht Software. Dafür läuft bei mir mittlerweile MQTT, Modbus, HM, HMIP, Z-Wave.
              Ich werde mich wohl noch mehrmals melden müssen.
              danke für die noch kommende Unterstützung.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              553
              Online

              31.6k
              Users

              79.5k
              Topics

              1.3m
              Posts

              3
              5
              191
              Loading More Posts
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes
              Reply
              • Reply as topic
              Log in to reply
              Community
              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
              The ioBroker Community 2014-2023
              logo