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

    Saving and reusing variables?

    Scheduled Pinned Locked Moved Lessons and Guides
    7 Posts 4 Posters 16.4k 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.
    • M Offline
      ManuXD32
      last edited by

      Hi, i've seen the new block in the beta (EEPROM) and I was wondering how can I save the data of the variables so I can use it after rebooting the M5.
      Example: the score of a game, save it so the next time you turn off and on the device the score is still there

      1 Reply Last reply Reply Quote 0
      • vkichlineV Offline
        vkichline
        last edited by

        Are you talking about NVS (Non Volatile Storage?)
        M5ez uses it for its preferences. Here is a file that reads and writes them in C: https://github.com/vkichline/M5ezSettingsStorage/blob/master/m5ez_prefs_storage.cpp

        Basically, just include preferences.h, call prefs.begin with false for read/write, then use the accessors from preferences.h and finish with prefs.end().

        M 1 Reply Last reply Reply Quote 1
        • M Offline
          ManuXD32 @vkichline
          last edited by

          @vkichline thank youuuu

          world101W 1 Reply Last reply Reply Quote 0
          • world101W Offline
            world101 @ManuXD32
            last edited by

            Hi @manuxd32,
            For uiFlow, there is an example of saving data as a key/value pair in M5 Docs.

            I also created a simple example like this...
            0_1598705685410_Screen Shot 2020-08-29 at 8.52.51 AM.png

            G M 2 Replies Last reply Reply Quote 1
            • G Offline
              Gaviota @world101
              last edited by

              How many write operations are maximal at the EPROM possible?

              A lot of nice M5Stack stuff :) ....

              world101W 1 Reply Last reply Reply Quote 1
              • world101W Offline
                world101 @Gaviota
                last edited by

                @gaviota said in Saving and reusing variables?:

                How many write operations are maximal at the EPROM possible?

                I was wondering the same thing. This source and in more detail this source say the typical is 100,000 write/erase cycles.

                I'm also wondering which address location uiFlow uses to store the key/value data to EEPROM. @m5stack or @lukasmaximus do you know?

                1 Reply Last reply Reply Quote 1
                • M Offline
                  ManuXD32 @world101
                  last edited by

                  @world101 thank you a lot!!!

                  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