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

    M5StickC Plus EEPROM Issue UIFLOW

    UIFlow
    2
    2
    1.4k
    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.
    • K
      kunal
      last edited by

      Hi,
      I'm using the EEPROM block from UIFLOW but i cant get it to work.
      Is there a bug? Or am i doing something wrong?
      0_1700249105537_433f9e24-247b-4573-ae32-6c3a13e99c2e-image.png

      This is the python:
      from m5stack import *
      from m5ui import *
      from uiflow import *
      import nvs
      from easyIO import *
      import time

      setScreenColor(0x111111)

      malas = None
      timer = None
      count = None

      c = M5TextBox(21, 64, "CURRENT", lcd.FONT_DejaVu18, 0xc7fadf, rotate=0)
      counter = M5TextBox(21, 91, "0", lcd.FONT_DejaVu40, 0x30ff23, rotate=0)
      label0 = M5TextBox(31, 167, "MALA'S", lcd.FONT_DejaVu18, 0x1fbef1, rotate=0)
      malac = M5TextBox(29, 199, "0", lcd.FONT_DejaVu24, 0xFFFFFF, rotate=0)
      BATTPERCENT = M5TextBox(3, 6, "BATTERY:", lcd.FONT_DefaultSmall, 0xFFFFFF, rotate=0)
      BATTIND = M5TextBox(57, 6, "0", lcd.FONT_DefaultSmall, 0xFFFFFF, rotate=0)
      timerx = M5TextBox(118, 6, "0", lcd.FONT_DefaultSmall, 0x676363, rotate=0)

      from numbers import Number

      def buttonA_wasPressed():
      global malas, timer, count
      timer = 61
      BATTIND.setText(str((str((map_value((axp.getBatVoltage()), 3.7, 4.1, 0, 100))) + str('%'))))
      count = (count if isinstance(count, Number) else 0) + 1
      counter.setText(str(count))
      malac.setText(str(malas))
      speaker.tone(500, 100)
      if count == 108:
      malas = (malas if isinstance(malas, Number) else 0) + 1
      malac.setText(str(malas))
      speaker.tone(500, 100)
      wait_ms(200)
      speaker.tone(500, 100)
      speaker.setVolume(5)
      speaker.sing(831, 2)
      speaker.sing(622, 2)
      speaker.setVolume(3)
      count = 0
      malac.setText(str(malas))
      pass
      btnA.wasPressed(buttonA_wasPressed)

      def buttonB_pressFor():
      global malas, timer, count
      count = 0
      malas = 0
      nvs.write(str('malas'), malas)
      counter.setText(str(count))
      malac.setText(str(malas))
      pass
      btnB.pressFor(0.8, buttonB_pressFor)

      axp.setLcdBrightness(50)
      malas = nvs.read_str('malas')
      speaker.setVolume(3)
      BATTIND.setText(str((str((map_value((axp.getBatVoltage()), 3.7, 4.1, 0, 100))) + str('%'))))
      counter.setText(str(count))
      malac.setText(str(malas))
      timer = 61
      while True:
      timerx.setText(str((str(timer) + str(''))))
      malac.setText(str(malas))
      timer = (timer if isinstance(timer, Number) else 0) + -1
      if timer == 0:
      nvs.write(str('malas'), malas)
      wait_ms(3)
      axp.powerOff()
      wait(1)
      wait_ms(2)

      1 Reply Last reply Reply Quote 0
      • P
        pandian.nano
        last edited by

        @kunal
        What is the real problem? Please explain in detail, we have tested it and it works on my side

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