Storing variables in between deepsleep
-
Hi all,
I am creating a data logger that I want to record the value of two inputs every 15 mins then send it via cellular at the end of the day.
In between recording I want it to go into deep sleep using machine.deepsleep. My understanding of deep sleep was that any variables will be deleted because it is like a reset. Can I store the variables in the flash during the day then delete them after sending them? If so how would I do it? If not is there any other way to do it or better way to do it?
-
@edward-dimmack said in Storing variables in between deepsleep:
@elizar Do you mean to a file on an SD card? Because we are not using an SD card in this application.
You can use the filesystem of the internal flashl. Your program files are stored there as well. But mind the wear. Depending on your task, the NVRAM shall be the better solution.
-
@elizar Do you mean to a file on an SD card? Because we are not using an SD card in this application.
-
Take into account that NVRAM capacity is 614 number of 32 bits :
What is the size limitation of the nvm storage in module pycom?
So 24 hours x 4 per hour x 2 numbers each time = 192 numbers/day, so it is ok.
-
@edward-dimmack Just write the values to a file. That eases debugging since you can download the file (using atom) whenever you like.
-
You can use NVS to store numbers.
pycom.nvs_set(key, value)
Set the value of the specified key in the NVRAM memory area of the external flash. Data stored here is preserved across resets and power cycles. Value can only take 32-bit integers at the moment.