Thanks! I am applying progmem now, but my lcd is showing some strange characters. The strings working ok inside serial moniter, but my lcd is still showing wrong thing. Could you tell me why?
#include <avr/pgmspace.h>
#include <LCD4Bit.h>
LCD4Bit lcd = LCD4Bit(4);
prog_char string_0[] PROGMEM = "String 0";
prog_char string_1[] PROGMEM = "String 1";
PGM_P PROGMEM string_table[] =
{
string_0,
string_1
};
char buffer[30]; // make sure this is large enough for the largest string it must hold
void setup()
{
Serial.begin(9600);
lcd.init();
}
void loop()
{
for (int i = 0; i < 2; i++)
{
strcpy_P(buffer, (char*)pgm_read_word(&(string_table*))); *
- lcd.printIn( buffer);*
- Serial.println( buffer );*
- delay( 500 );*
- }*
}