🤖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

    UiFlow 2.0
    1
    1
    1.3k
    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
      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
      • First post
        Last post