[UPDATE] Comprehensive Arduino Flash Memory via PROGMEM

A Few years ago I posed an encyclopaedic set of unit tests (here) that showed how to do anything in progmem.  It went through structs, strings, arrays and all the library functions that could use progmem. However as of arduino V1.55 a it was broken as things on the Arduino platform had changed, v1.6 compounded the issues. As I regularly get visitors to this page, I thought it was in need of an update.

So I present the code, updated to work on the latest platform. As per the last article:

  • This is not an intro to progmem article. The readership level is set at those who are already familiar with the arduino PROGMEM documentation here and the use of the F() macro and __FlashStringHelper*.
  • Its’ designed as a reference on how to accomplish many different common tasks in PROGMEM.
  • It’s  here  to save you the “lets see how to make this work” time and communicate common pitfalls.
  • The code is well documented, so you should be able to find what you need quickly.
  • There is data declarations out front,  assorted unit tests in setup() and a simple unit testing framework at the end of the file.
  • Some of the examples have  //JBYCDMUS after the line. This stands for “just because you can, doesn’t mean you should” implying It works but is not recommended.
  • To use this search for the method you need to use, and see it running in working tested code.