ESP12-F saving variable

Posted on
  • Hi!

    Please help - *has somebody solved procedure to save and read variable values in ESP12-F or similar module?* I cannot find helpful JS-sample for Espruino Web IDE.

    My ESP12-F receives some data over WiFi and should save updated value of one variable. After power reset my ESP12-F should use updated value of that variable from the last session.

    Thank you for any idea!

  • Hi user847700,

    take a look at the flash library and the module EEPROM on flash

  • Hi MaBe, thank you for your advise!
    above two links were tested on ESP12-F + "v1.95 4Mb" scatch. Unfortunately:

    Uncaught ReferenceError: "Flash" is not defined


    var f = new (require("FlashEEPROM"))();
    Uncaught Error: Module "FlashEEPROM" not found

    In final I got "sunny night" and found one solution that was tested and passed:
    step 1) write in the left side of Web IDE two lines:

    function getName(){return "NR.3";}

    simple call getName() returns NR.3 even after power reset. Perfect begin!

    step 2) function was changed like below:

    function getName(){return "NR.12";}

    reboot by power and call getName() ruturns NR.12 now!

    Hope it will work for long time. Anyway, I will glad to get yours better ideas.

    Thank you, Mike

  • So it is working for you - Great.

    Yes - the API reference just describes the modules and their functions. In JS it is standard to require the module you like to use. Internal modules like 'Flash' can be used directly in console other need to be uploaded by WebIDE like 'EEPROM', here you find more about Modules

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

ESP12-F saving variable

Posted by Avatar for user84770 @user84770