str2progmem

Contents

str2progmem#

Project source at lucaspcamargo/str2progmem

This script allows you to parse text files into PROGMEM blocks for Arduino, generating source and header files automatically.

It also works for generic C usage by setting the env var TARGET to generic.

Usage#

Given this string list:

# strings_en.txt
__IDENTIFIER str_en
Welcome to the Menu
I ¬9D NY!
¬01¬02¬ad¬0f¬ff

You can invoke the script as such:

./str2pgmspace strings_en.txt str_en

This will generate the files str_en.cand str_en.h. Then, after incluing the header, the strings can be used as such:

// On serial port
Serial.println( PGMSTR(STR_EN_GET(0)) );

// On an LCD
lcd.println( PGMSTR(STR_EN_GET(1)) );

See this post for more info.