Hi buddies,
I am using Arduino Nano Mega 328 to send picture via Multi Media Message with a GPRS module and a SIM card. Usually the picture is large, and if I define a char array, Arudino will tell me not enough memory.
The char array to store picture is 4051 bytes. I am trying to do it this way. First, define a const char array[4051] to use program memory to store the picture, then I define a char shortArray[1000]. Copy array[0~999] to short array, and send it to GPRS model, then repeat the action to copy array[1000~1999] to short array and send. so I can send the picture in four times with the array of 1000 bytes lenght.
But arduino still tell me not enough memory, who can help me? Thank you very much. I found if I remove the line “Serial.print(temp[j]);”,there will be no error.
const char hua[4051] = { ... };
int flag = 1;
//String smsContent;
void setup()
{
Serial.begin(9600);
Serial.flush();
}
void loop()
{
// put your main code here, to run repeatedly:
delay(1000);
if (flag == 1)
{
//sendSMS(smsContent);
//sendMMS(hua);
Serial.println("AT+CMMSINIT");
delay(1000);
Serial.println("at+cmmscurl=\"mmsc.monternet.com\"");
delay(1000);
Serial.println("AT+CMMSCID=1");
delay(1000);
Serial.println("AT+CMMSPROTO=\"10.0.0.172\",80");
delay(1000);
Serial.println("AT+CMMSSENDCFG=6,3,0,0,2,4");
delay(1000);
Serial.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"");
delay(1000);
Serial.println("AT+SAPBR=3,1,\"APN\",\"CMWAP\"");
delay(1000);
Serial.println("AT+SAPBR=1,1");
delay(1000);
Serial.println("AT+SAPBR=2,1");
delay(1000);
Serial.println("AT+CMMSEDIT=1");
delay(1000);
//Serial.println("AT+CMMSDOWN=\"PIC\",7955,40000");
Serial.println("AT+CMMSDOWN=\"PIC\",1430,40000");
delay(1000);
int i = 0;
int j=0;
char temp[1000];
[color=red] for (i=0;i<4;i++)
for (j=0;j<1000;j++)
{
temp[j]=hua[i*1000+j];
Serial.print(temp[j]);
}
[/color]
delay(1000);
Serial.println("AT+CMMSRECP=\"15214535541\"");
delay(1000);
Serial.println("AT+CMMSSEND");
delay(1000);
flag = 0;
}
}
[\code]