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

    Check your uPython version

    Scheduled Pinned Locked Moved PROJECTS
    5 Posts 4 Posters 9.8k Views 1 Watching
    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.
    • E Offline
      ehm.education
      last edited by

      0_1612516245921_1612516092645.jpg

      from m5stack import *
      from m5ui import *
      from uiflow import *
      import time
      import uos
      
      setScreenColor(0x000000)
      
      vstart = None
      vsysinfo = None
      vsecs = None
      vmins = None
      vtimetext = None
      
      battery = M5TextBox(0, 0, "loading", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
      uptime = M5TextBox(0, 32, "loading", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
      lb_sysinfo = M5TextBox(0, 64, "loading", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
      
      import math
      
      lcd.setBrightness(10)
      vstart = time.ticks_ms()
      vsysinfo = uos.uname()
      lb_sysinfo.setText(str(vsysinfo))
      while True:
        battery.setText(str((str(((str('Battery: ') + str((power.getBatteryLevel()))))) + str('%'))))
        vsecs = round(((time.ticks_ms()) - vstart) / 1000)
        vmins = math.floor(vsecs / 60)
        vtimetext = (str((vsecs % 60)) + str('s'))
        if vmins != 0:
          vtimetext = (str(((str(vmins) + str('m ')))) + str(vtimetext))
        vtimetext = (str('Uptime: ') + str(vtimetext))
        uptime.setText(str(vtimetext))
        wait_ms(2)
      
      1 Reply Last reply Reply Quote 0
      • M Offline
        mb
        last edited by

        Interesting, when executing on a M5Stack Core2 via REPL I get an error message:

        Traceback (most recent call last):
          File "<stdin>", line 21, in <module>
        AttributeError: 'TFT' object has no attribute 'setBrightness'
        
        world101W 1 Reply Last reply Reply Quote 0
        • world101W Offline
          world101 @mb
          last edited by

          @mb

          Different code...

          Core:
          lcd.setBrightness(10)

          Core2:
          screen.set_screen_brightness(10)

          1 Reply Last reply Reply Quote 0
          • M Offline
            mb
            last edited by

            I would prefer to have a stable API for all devices. Current situation makes re-use of code complicated.

            Someone could write a wrapper API to cover the differences ;-)

            alt text

            xkcd comic

            1 Reply Last reply Reply Quote 0
            • ajb2k3A Offline
              ajb2k3
              last edited by

              I'm trying to push for a unified API but the problem is that some of the devices are slightly different and require slightly different commands.
              Please add your request for a unified API to the suggestions list.

              UIFlow, so easy an adult can learn it!
              If I don't know it, be patient!
              I've ether not learned it or am too drunk to remember it!
              Author of the WIP UIFlow Handbook!
              M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

              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