# Saving data/varibles in makecode (NOT makecode arcade)

**URL:** https://forum.makecode.com/t/saving-data-varibles-in-makecode-not-makecode-arcade/36366
**Category:** micro:bit
**Created:** [May 4, 2025, 7:37pm UTC](https://forum.makecode.com/t/saving-data-varibles-in-makecode-not-makecode-arcade/36366 "2025-05-04T19:37:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![SWIFTGI](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/swiftgi/32/22059_2.png) [@SWIFTGI](https://forum.makecode.com/u/SWIFTGI)
#### Post date: [May 4, 2025, 7:37pm UTC](https://forum.makecode.com/t/saving-data-varibles-in-makecode-not-makecode-arcade/36366/1 "2025-05-04T19:37:01Z")

</div>

Hello I’m building a project and i need to save variables so even if the microbit gets reset or the batterys run out the variables dont get reset

THANK YOU! 🙂

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [May 5, 2025, 2:22pm UTC](https://forum.makecode.com/t/saving-data-varibles-in-makecode-not-makecode-arcade/36366/2 "2025-05-05T14:22:13Z")

</div>

Hi @SWIFTGI and welcome to the forum!

I don’t think there’s an official way to do this, but it has been discussed in the forum before ([here](https://forum.makecode.com/t/pull-cpp-files-online-makecode-microbit-org/19532/5)).

I haven’t tested recently, but I created an example extension to demonstrate the concept of storing a value to the micro:bit’s flash memory. It continues to hold a value across a reset or battery change, but not across reprogramming. You can add this extension to projects by: 1) Click on “+ Extensions”, 2) Paste the URL in the search box and press enter/return, and 3) Select the file for the extension. The URL is: [https://github.com/bsiever/microbit-pxt-flashstorage](https://github.com/bsiever/microbit-pxt-flashstorage) .

Here’s an example project that uses it: [https://makecode.microbit.org/\_hiXaDp0aoAuF](https://makecode.microbit.org/_hiXaDp0aoAuF) (again, I haven’t tested it recently):

- It’ll retrieve a stored counter when it starts.
- Button A increases the counter (but doesn’t update flash)
- Button A+B decreases the counters (but doesn’t update flash)
- Button B will update the flash with the current counter.
