Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

10
votes
1answer
14k views

Can I write to Flash Memory using PROGMEM?

On the documentation of Arduino, I quote: http://playground.arduino.cc/Learning/Memory Note: Flash (PROGMEM) memory can only be populated at program burn time. You can’t change > the values in ...
10
votes
2answers
8k views

Why can I not use pointers instead of array with PROGMEM?

I'm currently changing some libraries to use flash instead of RAM for string storage so that I do not run out of SRAM on a project. Some strings in the library are declared in this manner: const ...
7
votes
3answers
8k views

PROGMEM: do I have to copy data from flash to RAM for reading?

I have got some difficulties understanding the memory management. Arduino documentation says, it is possible to keep constants like strings or whatever I don't want to change during runtime in ...
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 ...
4
votes
1answer
252 views

PROGMEM : pgm_read_float_near() equivalent for double? (Arduino Due)

I'm using an Arduino Due where double have a size of 8 bytes. In my software, I use double table const stored in prog memory, I was using an UNO before and used pgm_read_float_near() to retreive these ...
4
votes
2answers
896 views

How is a 41KB char array filling up 256KB of program memory?

I have an array of 41,400 elements of type char, which I am trying to put in program memory on a Mega2560. It should have 256KB of flash memory, but when I try to compile my sketch, it says the size ...
4
votes
1answer
779 views

Flash String Helper object as variable

So I have a Bunch of commonly used char arrays to build commands in my library. So to preserve memory, I have them put into flash, via PROGMEM ext, typedef const char PROGMEM ProgChar; ProgChar AT[] =...
3
votes
2answers
482 views

How to correctly pack an unsigned long from 3 unsigned chars?

I would like to use 652 unsigned long values on an Arduino Uno, but it doesn't look like there's enough memory. I thought about the splitting unsigned long values to 3 unsigned chars to store in ...
3
votes
2answers
7k 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 ...
3
votes
2answers
166 views

PROGMEM char* mangled text

I wrote a program using PROGMEM for massive string arrays. One of the arrays worked, but when I added the second one, the serial output only puts out "th". Pastebin Code: http://pastebin.com/9U7QZQKn
2
votes
1answer
158 views

Problem when using PROGMEM on array holding notes for speaker on Arduino

The problem I've been having is a little weird. I'm trying to set up audio for my Arduino project and have been playing around with the example included in the IDE. The problem is whenever I try to ...
2
votes
1answer
81 views

Inherent delay running EEPROM.read()

I'm using EEPROM to store long term data for use in sketches (thanks to DarthRubik for the guidance). I store stuff like a location ("Garden") and a device name ("Greenhouse Monitor 02") plus ...
2
votes
1answer
576 views

Saving byte array in PROGMEM instead of SRAM

For an ethernet project I do, I need to store the Ethernet Shield's MAC address. I store it like that: byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0xE1, 0x85 }; That works OK, but in my project I need ...
2
votes
1answer
763 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
350 views

How do I upload sketch (and parameters) through a user interface

I'm pretty new to Arduino and I'm developing my first real-world project. I have a Arduino Mega with a full working sketch in it which is going to be placed in several distant places and I have a ...
1
vote
1answer
188 views

PROGMEM doesn't cause Sketch size to change

I'm trying to pinpoint some strange behaviour involving the use of PROGMEM and the size of a Sketch. I've written a library that contains a number of functions, in addition to several large global ...
1
vote
1answer
77 views

Is there a way to “list” (in BASIC, or “cat” in LINUX) the current sketch loaded in my xxxDUINO? [duplicate]

I was surprised when I couldn't find an old post where someone asked this question. Seems like a natural beginner, uh excuse me, "newbie" question, but then I'm a throw-back to the days when a home ...
1
vote
1answer
77 views

Initialize and read from a PROGMEM array of pointers to PROGMEM arrays

I'm working on a project for the arduino uno for which I need multiple constant arrays of bytes. Such an array is initialized like so: const byte charR[] PROGMEM = { B01111111,//top half ...
1
vote
4answers
2k views

How to pass a static const (progmem) array to a function

I'm implementing a voice synthesizer chip. To build a phrase, I create a list of phonemes like this: static const uint8_t PROGMEM heybuddy[] = { pPA5, pHH1, pEY, pPA5, pBB2, pAX, pDD2, pIY, pPA5,...
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 ...
1
vote
1answer
151 views

PROGMEM Corrupted Array

I am trying to store a large number of values into a couple of arrays using PROGMEM, but I am finding that a few of the values are read back corrupted. I am storing just 1s and 0s, but when I read ...
1
vote
1answer
340 views

Possible to “inline” PROGMEM strings into a structure array initialization?

I have the following structure: struct inst_t { const char *s1; const char *s2; }; I'd like to initialize a constant array of this structure like this where all the strings are PROGMEM'ed: ...
1
vote
1answer
60 views

Possible to determine at runtime whether a pointer is declared PROGMEM?

Is it possible to determine at runtime whether a pointer points to PROGMEM'ed values or regular values? This would give some flexibility when writing code that handles both.
1
vote
1answer
212 views

Arduino memory issue with old HP HDSP-2000 display chips

I'm running into memory issues with an Arduino Nano driving some old HDSP-2000/HDSP-2011 chips. I cannot seem to get the ASCII 5x7 array into PROGMEM and have it read properly. It's so low on memory ...
1
vote
1answer
57 views

Printing elements of char array from PROGMEM

Given: const char* PROGMEM names[] = {"Foo","Bar"}; Serial.print(names[0]); I get garbage output. Is there some function that will print the string from PROGMEM? E.G.: Serial.print(<function ...
1
vote
0answers
59 views

Arduino Program Memory Ran Out

I have a Arduino sketch I made and I have run out of dynamic memory on my Arduino Nano. How could I possibly reduce the amount of memory the program takes? (I'm not that good at this stuff) P.S: The ...
1
vote
0answers
96 views

Strange things happening with Arduino PROGMEM

I am currently working on a display library. The font should be stored in PROGMEM. The code looks something like this: unsigned int i = 0; Serial.println(pgm_read_byte(&font[1]),HEX); unsigned ...
1
vote
0answers
253 views

Writing objects to PROGMEM

A few days ago I encountered memory problems (SRAM shortage) on my Arduino. I've read a lot and fixed the problem, now i have around 900 bytes free in SRAM. However, i still have difficulties ...
1
vote
1answer
94 views

Sketch stops printing after writing a few times

I am trying to build a random horoscope printer. I have a series of strings in an array which I am storing in program memory. I then pick a random number and print that index concatenated with a title....
0
votes
1answer
128 views

Unrecognizable Message From PROGMEM char*

I'm using a PROGMEM char* to store a massive array. When I try to print a certain part of the array, the message comes out mangled. How do I fix this? The output should be "Poliwag", but it comes out ...
0
votes
1answer
40 views

Read nested array item from PROGMEM

I have a 2D array of uint16_t arrays (IR Remote Codes). Due to the size of this data in RAM I'm having all kinds of trouble when my array is larger than one code. Thus, I have been trying to move this ...
0
votes
1answer
276 views

Using PROGMEM in constructor

Is it safe to use PROGMEM variable like dynamically allocated memory (a pointer to PROGMEM variable which is out of scope). I need this so I can generate a variable size (before compilation), ...
0
votes
3answers
273 views

How to store IR data needed for AC controll in less space?

I'm trying to controll an AC unit but the issue is space - right now, I store the data like this: consts PROGMEM unsigned int Signal_Heat_Fan0_Temp30[] = {233,636,17884,3032,8944,500,496,492,1496,524,...
0
votes
1answer
242 views

Unusual behaviour when moving data to PROGMEM

I've got some working code with a definition that looks like this: const unsigned char DynTextPositions[10][4][4] = { ... }; Which is defined / referenced via a header: #include <avr/...
0
votes
2answers
416 views

PCM audio, PROGMEM sounds through speaker, multiple clips (using speaker_pcm)

I downloaded the PCM Audio speaker_pcm (see link below) and it worked easily with the supplied Mac startup chime. I also got my own sounds parsed properly via a combination of sox and wav2c ...
0
votes
1answer
195 views

question about progmem

I have a problem understanding the following code: PROGMEM prog_uint16_t x={1232,3232,43343}; rawlen = pgm_read_word_near(x); memcpy_P(uSendBuff, pfSendBuff+1, rawlen * sizeof(uint16_t)); Why do we ...
0
votes
2answers
44 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'...
0
votes
1answer
164 views

Arduino IDE: How to get PROGMEM const length?

I have defined a byte array as a constant in the Atmel's flash memory: const uint8_t eye [] PROGMEM = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff }; How ...
0
votes
1answer
141 views

FastLED + structs + PROGMEM strange behavior

I'm afraid I have to post a lengthy bit of code, because I can't pinpoint what's causing my issues – in short, it appears repeatedly adding float position + float speed in a struct ends up borking the ...
0
votes
1answer
130 views

Store RAM and PROGMEM strings in one variable

I want to store a number of strings in an object. Currently I have: class MyClass { int numStrings = 0; ??? strings[20]; public: void addString(const char str[]); void print(); }; ...
0
votes
1answer
597 views

PROGMEM on Arduino Due (ARM Cortex M3)

I've been working with the PROGMEM function on my Arduino Uno and I'm thinking about changing to the bigger Arduino Due which is based on a ARM Cortex M3 processor instead of the AVR processor on the ...
0
votes
1answer
556 views

Store 3-dimensional char array in program memory with PROGMEM

I'm running a sketch whith a quite big, constant three dimensional char array (or simply, a table of strings). As this takes lots of RAM I'd like to store it in programm memory in order to keep the ...
0
votes
1answer
271 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
1answer
413 views

Data from PROGMEM array mismatches initialisation

The amount of memory needed for my user interface is outrageous. Hence I decided to use flash memory. But after some successful readouts from program space, problems emerge. Updated: I have some ...
0
votes
0answers
20 views

Using a 48 characters char[] for PROGMEM

I am trying to create a charliplexed display of 6x8 LEDS using a Arduino Nano with the ATMega328p chip. Because of the limited storage I am trying to use PROGMEM. I did my research and found some ...
0
votes
0answers
89 views

OV7670 Arduino Camera Sensor Module colour image problem

I am working on OV7670 Camera Sensor with Arduino uno board, it is work ok in VGA mode , but images capture in black and white mode, i tried to find tutorial for set RGB mode for capture images bat i ...
0
votes
1answer
55 views

LDC paired with Arduino locks up and freezes. Out of SPRAM?

I am making an alarm clock using a 4x20 lcd display, rtc, and Arduino Pro Mini 3.3v. I have implemented a menu system for setting the time/date that blinks the text on the lcd display to indicate that ...
0
votes
1answer
1k views

Printing char array from array of structs in progmem to serial

(I apologize if this is a c++ question, I'm too green to know if this is unique to the Arduino IDE) I've moved an array of structs into my PROGMEM because I was running into memory issues: #define ...
0
votes
0answers
216 views

Arduino code quits running loop after short time Ethernet shield

I'm trying to make a temperature logger that posts to MySQL. I have done this successfully, but my code will only run for approximately 15-20 minuets. I don't think it is a power issue as I have tried ...
-1
votes
2answers
68 views

ATmega328, arduino nano v3 code error saying insufficient ram memory [closed]

the code error says this and im not sure what to do please i need urgent help :(` // Easy bluetooth controlled scrolling text // by Yoruk for Instructable // 26 02 15 : first code // 03 03 15 : ...