🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Using the Set Bit Block

    UIFlow
    2
    3
    3.7k
    Loading More Posts
    • 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.
    • U
      uppermill
      last edited by

      I am trying to use the set bit block and having problems. I have attached a simple program to illustrate the problem.0_1614783654835_5b0c9f58-cb6b-4fed-85fa-2b514ebd23f0-image.png

      The python code generated is
      0_1614783747974_9532c1ed-5674-44c4-85a9-51e2a3d0a248-image.png

      On an M5Core, I get the error

      unsupported types for or:'NoneType', 'int'

      Can someone help me to resolve the problem?

      Allan

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @uppermill

        try to set var1 to 0 before setting the bit.

        var1 = 0
        var2 = (var1 | (0x01 << 0))
        

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 1
        • U
          uppermill
          last edited by

          Thanks - elementary error on my part. Problem resolved.

          Allan

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