Sparki Memory Management

Cleaning out the attic of Sparki's memory.

SparkiDuino
Hard

Lessons You Should Know

Introduction

Sparki only has so much memory, 2500 bytes (2.5Kb) of RAM (working memory) and 32,000 bytes (32Kb) of flash (storage) to be exact.Sometimes you’ll want to use more memory than Sparki has with its default programming.  You can use put these lines of code at the top of the Sparki.h fileto free up ram and flash:These lines work by disabling certain parts of Sparki that eat up memory. The LCD in particular uses a lot of RAM because there are a lot of pixels to keep track of:
128×64 pixels = 8192 bits
8 bits in a byte = 1024 bytes of ram
Seeing as Sparki only has 2500 bytes of ram, that’s a lot of room saved!

Editing Sparki.h

Due to the way the precompiler works, these lines don’t work if you put them into your arduino code, they have to be put into Sparki.h. You can find this file:

In Windows:
C:\Program Files (x86)\SparkiDuino\hardware\arduino\avr\cores\arduino

In Osx:

inside the application (right click>Show Package Contents) >Contents\Java\hardware\arduino\avr\cores\arduino