Arduino dynamic memory shortage

Pro-test is useful,

 

Reference: https: //blog.csdn.net/weixin_33915554/article/details/86975847

 

If you use the code into an array, but the array capacity of more than 20,000, an array of content for the main program calls. Dynamic memory shortage occurs when the array is placed inside the loop compiler

 

 

Solution: put this static arrays on FLASHROM MCU's, but need not be present in RAM. Try this: const unsigned char wav [] PROGMEM = {.......}; PROGMEM here is put on flashrom array, the array contents when read with pgm_read_byte (& wav [123]); / / 124 Suppose the reading group elements such as read. Beginning of the program plus #include <avr / pgmspace.h> arduino more directly to the official website to see it http://www.arduino.cc/en/Reference/PROGMEM ----------- ---------- author: weixin_33915554 source: CSDN original: https: //blog.csdn.net/weixin_33915554/article/details/86975847 copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/MCSFX/p/11039305.html
Recommended