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

    Core2: Vibration motor intensity setting support..

    Bug Report
    2
    5
    9.2k
    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.
    • SkinkS
      Skink
      last edited by

      @m5stack
      With "Set vibration intensity" alone the vibration motor does not work at all, no matter if 1-100%.
      If I switch it on with "Set vibration enable (true)" the motor will vibrate but with the same intensity, I try to change the intensity with "Set vibration intensity" but nothing happens.
      I can only switch it off with "Set vibration enable (false)"!

      I am involved in everything that has to do with automation, including the M5Stack's, a few 3D printers, a CNC mill and a lot of other things. The M5Stack's are all really great, I can't imagine a better prototyping.

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

        Hello @Skink

        that is not very surprising. To set the vibration intensity an underlying function SetLDOVoltage() is used which currently is broken in M5Core2 library as pointed out by @veryalien :
        https://github.com/m5stack/M5Core2/issues/4.

        I've proposed a fix in a pull-request which got closed as it should be fixed in the near future anyways as @Hades2001 pointed out:
        https://github.com/m5stack/M5Core2/pull/5

        Cheers
        Felix

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

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

          Hi @Skink

          here is a Python solution. Button A decreases, Btn C increases intensity. Btn B turns vibration motor on and off:

          from m5stack import *
          from m5stack_ui import *
          from uiflow import *
          import i2c_bus
          
          screen = M5Screen()
          screen.clean_screen()
          screen.set_screen_bg_color(0xFFFFFF)
          
          label0 = M5Label('Text', x=52, y=67, color=0x000, font=FONT_MONT_24, parent=None)
          
          from numbers import Number
          
          motorOnOff = None
          motorValue = None
          temp = None
          
          def setMotorValue():
            global motorOnOff, motorValue, temp
            label0.set_text(str(motorValue))
            temp = (i2c0.read_u8(0x28)) & 0xF0
            temp = temp | motorValue
            i2c0.write_mem_data(0x28, temp, i2c_bus.UINT8LE)
          
          def buttonA_wasPressed():
            global motorOnOff, motorValue, temp
            if motorValue > 0:
              motorValue -= 1
            setMotorValue()
            pass
          btnA.wasPressed(buttonA_wasPressed)
          
          def buttonC_wasPressed():
            global motorOnOff, motorValue, temp
            if motorValue < 15:
              motorValue += 1
            setMotorValue()
            pass
          btnC.wasPressed(buttonC_wasPressed)
          
          def buttonB_wasPressed():
            global motorOnOff, motorValue, temp
            motorOnOff = not motorOnOff
            power.setVibrationEnable(motorOnOff)
            pass
          btnB.wasPressed(buttonB_wasPressed)
          
          i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x34, freq=400000)
          motorOnOff = False
          motorValue = 7
          setMotorValue()
          

          Cheers
          Felix

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

          SkinkS 1 Reply Last reply Reply Quote 1
          • SkinkS
            Skink @felmue
            last edited by

            Hello Felix,

            Thank you, I have tested your program and it works perfectly. Thank you very much for that !

            THX skink

            I am involved in everything that has to do with automation, including the M5Stack's, a few 3D printers, a CNC mill and a lot of other things. The M5Stack's are all really great, I can't imagine a better prototyping.

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

              Hi skink

              you're very welcome.

              The required fix mentioned before has now been included to the M5Core2 library so hopefully in one of the next UIFlow updates it will be picked up.

              Happy Stacking!
              Felix

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

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