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

    Button on CoreS3 not working

    Scheduled Pinned Locked Moved UiFlow 2.0
    1 Posts 1 Posters 2.2k Views
    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.
    • P Offline
      ps.oz
      last edited by

      Using UiFlow2 alpha-17
      I have a button on CoreS3 on black port B
      I try to retrieve its value
      I get an error hardware/button.py line 25 in isHolding
      AttributeError 'super' object has no attribute 'last_state'

      Here's the code

      import os, sys, io
      import M5
      from M5 import *
      from unit import *

      title0 = None
      label0 = None
      dual_button_0_blue = None
      dual_button_0_red = None

      isHold = None

      def setup():
      global title0, label0, dual_button_0_blue, dual_button_0_red, isHold

      dual_button_0_blue, dual_button_0_red = DualButton((8, 9))
      M5.begin()
      Widgets.fillScreen(0x222222)
      Widgets.fillScreen(0x222222)
      title0 = Widgets.Title("Title", 3, 0xFFFFFF, 0x0000FF, Widgets.FONTS.DejaVu18)
      label0 = Widgets.Label("Text", 20, 76, 1.0, 0xffffff, 0x222222, Widgets.FONTS.DejaVu18)

      title0.setText('Main')
      isHold = 0

      def loop():
      global title0, label0, dual_button_0_blue, dual_button_0_red, isHold
      M5.update()
      isHold = dual_button_0_blue.isHolding()
      label0.setText(str((str(isHold))))

      if name == 'main':
      try:
      setup()
      while True:
      loop()
      except (Exception, KeyboardInterrupt) as e:
      try:
      from utility import print_error_msg
      print_error_msg(e)
      except ImportError:
      print("please update to latest firmware")

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post