Need some PROGMEM suggestions
hi all,
here planning do:
i have many short messages display on lcd in different places in program. add few hundred bytes. i'm migrating them progmem.
from sample codes wrote these lines:
basically store number of strings in flash, store address in pointer array in flash (progmem sample code). way seems work best series of strings menu options. may index message extract menu item indicator variable.
if these messages have not displayed in secquence, still have define pointer array or can use char array name in way? thank you!
psudo code
there's not whole lot progmem on arduino.cc
here planning do:
i have many short messages display on lcd in different places in program. add few hundred bytes. i'm migrating them progmem.
from sample codes wrote these lines:
code: [select]
progmem prog_char msg_00[]="any key start";
progmem const char *msg_item[] = {msg_00};
char msg_buffer[20];
strcpy_p(msg_buffer,(char*)pgm_read_word(&(msg_item[pt])));
//do something.basically store number of strings in flash, store address in pointer array in flash (progmem sample code). way seems work best series of strings menu options. may index message extract menu item indicator variable.
if these messages have not displayed in secquence, still have define pointer array or can use char array name in way? thank you!
psudo code
code: [select]
progmem prog_char msg_00[]="any key start";
char msg_buffer[20];
strcpy_p(msg_buffer,(char*)msg_00); // how make line work?
//do something.there's not whole lot progmem on arduino.cc

quote
there's not whole lot progmem on arduino.c
there quite page it, including examples...
(a) if not need list of string addresses in flash not have create it.
(b) can access of strings like
code: [select]
prog_char *strings[] progmem {"zero", "one", "two", "three"};
strcpy_p(msg_buffer, strings[1]);
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Need some PROGMEM suggestions
arduino
Comments
Post a Comment