Questions tagged [progmem]

PROGMEM is a keyword used when declaring a variable that keeps the data in flash instead of copying it into SRAM. It is part of the `pgmspace.h` library. Use this tag for discussions about using this attribute.

Filter by
Sorted by
Tagged with
3
votes
2answers
8k views

Using PROGMEM to store array of structs

I am hitting the limits of my arduino's SRAM and found that SRAM usage can be reduced by storing static stuff in flash memory instead of SRAM. My project can (optionally) be built with an included ...
6
votes
1answer
2k views

What are the benfits of global variables over static class members?

On an embedded system we use global variables often to keep dynamic memory consumption on heap and stack low. But global variables are also considered bad programming practice if they aren't used in a ...
2
votes
1answer
898 views

Better method for PROGMEM data access with multiple indirection?

-edit- This is a simplified recreation of personal learning project I have ongoing. My issue is in accessing data in flash, the path to which includes multiple layers of indirection. When the data ...
1
vote
3answers
3k views

Storing array in PROGMEM

I have an array of a lot of numbers (1 and 0) but i can't store them since arduino does not have enough space. How can i save an array of example 00110 in PROGMEM, then read from PROGMEM and set x to ...
0
votes
1answer
352 views

Reading a 10-byte buffer out of a PROGMEM string stored in a string table

I'm storing a large snippet of text in three separate PROGMEM char arrays: const char script1[] PROGMEM = "...."; const char script2[] PROGMEM = "...."; const char script3[] PROGMEM = "...."; The ...
0
votes
2answers
65 views

Accessing 2 dimensional array in PROGMEM inside loop

I am unable to access elements of a 2D PROGMEM array from inside a loop. Please see the following example: const byte a1[] PROGMEM = {'a', 'b', 'c', 'd'}; const byte a2[] PROGMEM = {'e', 'f', 'g', 'h'...