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:
1 2 3 |
#define NO_LCD // disables the LCD, frees up 3088 Bytes Flash Memory, 1k RAM #define NO_ACCEL // disables the Accelerometer, frees up 598 Bytes Flash Memory #define NO_MAG // disables the Magnetometer, frees up 2500 Bytes Flash Memory |
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