Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "MicroBit.h"
- MicroBit uBit;
- int main()
- {
- uBit.init();
- KeyValuePair* firstTime = uBit.storage.get("boot");
- int stored;
- if(firstTime == NULL)
- {
- //this is the first boot after a flash. Store a value!
- stored = 1;
- uBit.storage.put("boot", (uint8_t *)&stored, sizeof(int));
- uBit.display.scroll("Stored!");
- }
- else
- {
- //this is not the first boot, scroll our stored value.
- memcpy(&stored, firstTime->value, sizeof(int));
- delete firstTime;
- uBit.display.scroll(stored);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement