Skip to main content

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
-1 votes
1 answer
195 views

Large arrays crash the arduino

I have three large PROGMEM arrays, in order to store musical notes for a song. One array is the notes, one is the note durations, and one is the pause after the note. The first array is an int one and ...
user1584421's user avatar
  • 1,405
-1 votes
1 answer
74 views

Can I use [[__progmem__]] instead of PROGMEM?

In pgmspace.h, PROGMEM is defined as __ATTR_PROGMEM__, which is defined as __attribute__((__progmem__)). AFAIK, __attribute__ is GNU only. Since C++ 11, we have the attribute specifier sequence. I can'...
Thomas Weller's user avatar
2 votes
2 answers
282 views

PlatformIO and const PROGMEM

I'm using the DuinoWitchery LCD library (https://github.com/duinoWitchery/hd44780) in a PlatformIO Arduino project with CLion. The following code works if I stick it in main.cpp: // near top of class.....
Bitbang3r's user avatar
  • 543
0 votes
1 answer
81 views

Send a 2d PROGMEM array over SoftwareSerial

I have a 2d array: const byte messages_for_measurement[2][8] PROGMEM = { { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }, { 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10 }, }; I want to send ...
user1584421's user avatar
  • 1,405
1 vote
2 answers
391 views

Is there a good reference for Arduino Due memory architecture and usage?

It's been harder than I expected to find a reference source or usage guide. There's a number of sources I've looked at along the road to this question: The Due is listed here and here as having 512KB ...
RowanP's user avatar
  • 869
0 votes
1 answer
106 views

strcpy_P increases IROM usage by 400%

Using ESP8266 (NodeMcu 1) in Arduino IDE: I can't upload my sketch because a single call to strcpy_P seems to increase the IROM usage by about 400%: 25% total usage without the call, 100+% with the ...
user187's user avatar
  • 13
1 vote
1 answer
757 views

Read bytes from PROGMEM array

Disclaimer: I just started using C++ and I'm a bit of a beginner. Keep that in mind as your answering. So I recently bought my first Arduino. It's a customized one and it has an 8x8 display attached ...
gurkensaas's user avatar
1 vote
1 answer
169 views

PROGMEM for IR command storage

I'm working on a code that is able to send raw data as IR signal to IR transmitter, the memory of arduino Nano is not enough to store the array in SRAM storage,so i'm about to use PROGMEM to store ...
M sayeh's user avatar
  • 31
5 votes
4 answers
1k views

How can a function/method determine if a const array passed in is PROGMEM (flash) or not (RAM)?

Is it possible for a function/method to know if a constant array that has been passed in is in flash or RAM? If I have a method or function that receives a constant array that is in RAM, the array is ...
Casey's user avatar
  • 151
-2 votes
1 answer
157 views

Reading PROGMEM results in an incorrect hex value [closed]

I'm sure I'm doing something stupid here, but the code below is supposed to write the test hex values to a I2C EEPROM, however when I attempt to read the EEPROM it has the wrong values. Directly ...
Ryan Rife's user avatar
0 votes
1 answer
880 views

How to create large progmem arrays and not annoy the linker

I have a rather complex project (PlatformIO, but I've also had this happen in the vanilla IDE) with several nested includes. Let's say that there are three files and a main sketch. The main sketch ...
user avatar
0 votes
2 answers
889 views

Initialize object with PROGMEM constants

I have a class which has a const char * property: class A { public: const PROGMEM char* text; }; void setup() { // A a{"Hello World!"}; // A a{PSTR("...
zhekaus's user avatar
  • 439
0 votes
1 answer
2k views

ESP8266 compilation error: "previous declaration of 'HTTPMethod HTTP_HEAD'"

I have an ESP8266 program that used to work but is now failing to compile with this error: C:\...\Arduino\libraries\WiFiManager/WiFiManager.h:25:24: note: in expansion of macro 'PROGMEM' const ...
garson's user avatar
  • 159
0 votes
1 answer
2k views

Use of progmem in ESP8266 vs AVR and also how to handle large dynamic strings

This is a somewhat tricky question dealing with implementation and best-practices of the ESP8266. I'd ideally hope that it's answered by people with in-depth knowledge on the problem. As you are ...
user avatar
-1 votes
1 answer
1k views

How to use PROGMEM in a .h/.cpp file instead of a .ino file?

I want to use a lot of .h/.cpp files to be used by my ino sketch. In one of these .cpp files (and later more) I want to use constant arrays (like lookup tables). To save SRAM I want to use PROGMEM. ...
Michel Keijzers's user avatar
1 vote
0 answers
182 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 ...
sdieters's user avatar
0 votes
1 answer
758 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 ...
Aaron Ciuffo's user avatar
0 votes
2 answers
616 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'...
Arundale Ramanathan's user avatar
1 vote
2 answers
878 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 ...
Bob Jones's user avatar
  • 131
1 vote
1 answer
133 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 ...
JustAnotherBitcoin's user avatar
1 vote
1 answer
709 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 ...
Bo Thompson's user avatar
0 votes
2 answers
119 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 : ...
Sam's user avatar
  • 1
0 votes
1 answer
199 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 ...
cr5519's user avatar
  • 23
2 votes
0 answers
273 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 ...
w7sbc's user avatar
  • 21
1 vote
1 answer
557 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 ...
KaYBlitZ's user avatar
0 votes
1 answer
2k 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 ...
needfulthing's user avatar
1 vote
2 answers
1k 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 ...
MEANMACHINE's user avatar
0 votes
1 answer
2k 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 ...
Bo Thompson's user avatar
2 votes
1 answer
398 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 ...
fritterdonut's user avatar
0 votes
1 answer
459 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 ...
Bogdan Stăncescu's user avatar
0 votes
1 answer
389 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(); }; ...
AndreKR's user avatar
  • 190
1 vote
1 answer
2k 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 ...
tr01's user avatar
  • 117
0 votes
1 answer
1k 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 ...
tr01's user avatar
  • 117
0 votes
2 answers
2k 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 ...
Pete Zelchenko's user avatar
3 votes
2 answers
651 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 retrieve these ...
snoob dogg's user avatar
-5 votes
1 answer
303 views

i am working on a project smart watch i am getting this error please help

Arduino: 1.6.7 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)" WARNING: Spurious .github folder in 'Adafruit SSD1306' library In file included from C:\Program Files (x86)\...
hero's user avatar
  • 1
2 votes
1 answer
367 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 ...
Jo-Bob Bubba's user avatar
-1 votes
1 answer
706 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), ...
Vasil Kalchev's user avatar
1 vote
1 answer
606 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 ...
jozilla's user avatar
  • 43
1 vote
1 answer
98 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 ...
user avatar
4 votes
1 answer
2k 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[] =...
Steven Venham's user avatar
2 votes
0 answers
525 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 ...
KeV's user avatar
  • 121
2 votes
4 answers
6k 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,...
Rampant Creative Group's user avatar
3 votes
2 answers
3k 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 ...
yigiped's user avatar
  • 33
2 votes
1 answer
136 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 ...
acpilot's user avatar
  • 653
1 vote
1 answer
650 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: ...
Ana's user avatar
  • 480
1 vote
2 answers
253 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.
Ana's user avatar
  • 480
2 votes
1 answer
1k 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 ...
Ido Daniel's user avatar
3 votes
2 answers
638 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 ...
George Profenza's user avatar
0 votes
3 answers
5k 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 ...
Arduino's user avatar
  • 11