i have the following code
#include <avr/pgmspace.h>
// The list is from http://www.cosmobrain.com/cosmobrain/res/brightstar.html
const prog_char Star01[] PROGMEM = "Sirius";
const prog_char Star02[] PROGMEM = "Canopus";
const prog_char Star03[] PROGMEM = "Arcturus";
const prog_char Star04[] PROGMEM = "RigilKentaurus";
const prog_char Star05[] PROGMEM = "Vega";
const prog_char Star06[] PROGMEM = "Capella";
const prog_char Star07[] PROGMEM = "Rigel";
const prog_char Star08[] PROGMEM = "Procyon";
const prog_char Star09[] PROGMEM = "Achernar";
const prog_char Star10[] PROGMEM = "Betelgeuse";
const prog_char Star11[] PROGMEM = "Hadar";
const prog_char Star12[] PROGMEM = "Altair";
const prog_char Star13[] PROGMEM = "Aldebaran";
const prog_char Star14[] PROGMEM = "Antares";
const prog_char Star15[] PROGMEM = "Spica";
const prog_char Star16[] PROGMEM = "Pollux";
const prog_char Star17[] PROGMEM = "Fomalhaut";
const prog_char Star18[] PROGMEM = "Mimosa";
const prog_char Star19[] PROGMEM = "Deneb";
const prog_char Star20[] PROGMEM = "Acrux";
const prog_char Star21[] PROGMEM = "Regulus";
const prog_char Star22[] PROGMEM = "Adhara";
const prog_char Star23[] PROGMEM = "Gacrux";
const prog_char Star24[] PROGMEM = "Shaula";
const prog_char Star25[] PROGMEM = "Bellatrix";
const prog_char Star26[] PROGMEM = "ElNath";
const prog_char Star27[] PROGMEM = "Miaplacidus";
const prog_char Star28[] PROGMEM = "Alnilan";
const prog_char Star29[] PROGMEM = "AlNa'ir";
const prog_char Star30[] PROGMEM = "Alioth";
const prog_char Star31[] PROGMEM = "Gama2";
const prog_char Star32[] PROGMEM = "Mirfak";
const prog_char Star33[] PROGMEM = "Dubhe";
const prog_char Star34[] PROGMEM = "Wezen";
const prog_char Star35[] PROGMEM = "KausAustralis";
const prog_char Star36[] PROGMEM = "Avior";
const prog_char Star37[] PROGMEM = "Alkaid";
const prog_char Star38[] PROGMEM = "Sargas";
const prog_char Star39[] PROGMEM = "Menkaliman";
const prog_char Star40[] PROGMEM = "Atria";
const prog_char Star41[] PROGMEM = "Alhena";
const prog_char Star42[] PROGMEM = "Peacock";
const prog_char Star43[] PROGMEM = "Delta";
const prog_char Star44[] PROGMEM = "Mirzam";
const prog_char Star45[] PROGMEM = "Castor";
const prog_char Star46[] PROGMEM = "Alphard";
const prog_char Star47[] PROGMEM = "Hamal";
const prog_char Star48[] PROGMEM = "Polaris";
const prog_char Star49[] PROGMEM = "Nunki";
const prog_char Star50[] PROGMEM = "DenebKaitos";
PGM_P StarList[] PROGMEM =
{
Star01,Star02,Star03,Star04,Star05,Star06,Star07,Star08,
Star09,Star10,Star11,Star12,Star13,Star14,Star15,Star16,
Star17,Star18,Star19,Star20,Star21,Star22,Star23,Star24,
Star25,Star26,Star27,Star28,Star29,Star30,Star31,Star32,
Star33,Star34,Star35,Star36,Star37,Star38,Star39,Star40,
Star41,Star42,Star43,Star44,Star45,Star46,Star47,Star48,
Star49,Star50
};
char StrBuffer[14];
void setup()
{
Serial.begin(9600);
for(byte j = 0; j<20; j++)
Serial.println(GetPrgStr(StarList[j]));
}
void loop()
{
}
char* GetPrgStr(const char* str)
{
strcpy_P(StrBuffer, (char*)str);
return StrBuffer;
}
the arduino uno resets each time i run this code
if i use Serial.println(GetPrgStr(LCD_List[10])); it works
What i did wrong in the loop?
Thanks