
Originally Posted by
PaulStoffregen
On Teensy 3.0, all you have to do is use "const" in the variable declaration. Or at least that's all you're supposed to do. Everything that's "const" gets put into flash without consuming any RAM.
Apparently this includes literal constants.
Code:
void setup() {
Serial.begin(1200);
delay(1000);
Serial.print(
"\n"
"ACT I\n"
"SCENE I. A desert place.\n"
"\n"
" Thunder and lightning. Enter three Witches \n"
"\n"
"First Witch\n"
"\n"
" When shall we three meet again\n"
" In thunder, lightning, or in rain?\n"
"\n"
// and so on for the entire play
"\n"
" Flourish. Exeunt\n"
);
}
void loop() {
}
which compiles and fits into flash on Teensy 3.0
Code:
Binary sketch size: 119,956 bytes (of a 131,072 byte maximum)
Estimated memory use: 3,616 bytes (of a 16,384 byte maximum)
(As seen here, modified to only print once).