Uso di troppi "IF" con ethernet shield

Ciao, usare PROGMEM per archiviare le stringhe in flash ti aiuta a risparmiare RAM, è utile se hai tante stringhe, ma per poter usare le stringhe devi recuperala dalla flash e caricarle in RAM, ad ogni modo provo a farti un piccolo esempio di come lo sto usando io, spero che il codice sia chiaro

#include <avr/pgmspace.h>
 
prog_char CIP [] PROGMEM = {"<a href='/accendi0'>Accendi LED 0</a>
<a href='/spegni0'>Spegni LED 0</a>
"};
char *buf;


void setup() {   
  Serial.begin(9200);  
}

void loop() {
  
  SendATCmdWaitRespP(CIP);
  Serial.println(buf);
  delay(2000);
  free(buf); //importante
  
}

void SendATCmdWaitRespP(prog_char *str)
{	
        buf = (char *) malloc(LenP(str)*sizeof(char));
	byte i=0; 	
        
	for (char c; (c = pgm_read_byte (str)); str++)
	      buf[i++] = c;
        
        buf[i] = '\0';	             
}

byte LenP(prog_char *str)
{	
	byte i=0;
        
        for (char c; (c = pgm_read_byte (str)); str++)
		i++;               
		
	return i;	
}

magari c'è un modo migliore :wink: e imparo anch'io.