@Jeff said in Persistance, and waking from sleep:

...so, since a reset is performed, why even have code after the reset? Wouldn't it be more accurate (and less confusing) to just have:

Maybe, but my thought was to just remove the reset part in future releases of Mono Framework. The concept is that Mono does not have to reset upon wake, so when I fix the bug - you are all free to remove the reset statement.

OK, onto the real issue... I don't want to perform a reset when the wake button is pressed, and I want to persist some data. Is there a way to do this?

Mono's CPU (PSoC5) has 2 Kb of EEPROM, which is persistent. But it has limited write cycles. We also plan to reserve some of that memory for Wifi config and other settings. You can see how we plan to utilize the eeprom here:

https://github.com/getopenmono/mono_framework/blob/master/settings_interface.h

Otherwise, you should just use the SD Card option. Get a microSD Card, format as FAT32 and you have access to libc's Std I/O functions: fopen, fread, fwrite, fprintf etc. I will write a guide on the developer docs on how to use the SD Card shortly.