jitender71
Newbie level 2
- Joined
- Feb 13, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,295
hi
help me plz
i cant able to read message with ardiuno 328
i m use sim300
i send sms to another number
and call to another number
but i m not read message when i send to another number
char data[256];
int x;
void setup(){
Serial.begin(115200); // UART baud rate
delay(2000);
// switches the module ON
for (int i=0;i < 5;i++){
delay(5000);
}
Serial.println("AT+CMGF=1"); // sets the SMS mode to text
delay(1000);
}
void loop(){
Serial.println("AT+CMGR=1"); //Reads the first SMS
Serial.flush();
for ( x=0;x < 255;x++){
data[x]='\0';
}
x=0;
do{
while(Serial.available()==0);
data[x]=Serial.read();
x++;
if(data[x-1]==0x0D&&data[x-2]=='"'){
x=0;
}
}while(!(data[x-1]=='K'&&data[x-2]=='O'));
data[x-3]='\0'; //finish the string before the OK
Serial.println(data); //shows the message
delay(5000);
}
i use this code but i dont get my message
serial monitor show nothing
help me plz
i cant able to read message with ardiuno 328
i m use sim300
i send sms to another number
and call to another number
but i m not read message when i send to another number
char data[256];
int x;
void setup(){
Serial.begin(115200); // UART baud rate
delay(2000);
// switches the module ON
for (int i=0;i < 5;i++){
delay(5000);
}
Serial.println("AT+CMGF=1"); // sets the SMS mode to text
delay(1000);
}
void loop(){
Serial.println("AT+CMGR=1"); //Reads the first SMS
Serial.flush();
for ( x=0;x < 255;x++){
data[x]='\0';
}
x=0;
do{
while(Serial.available()==0);
data[x]=Serial.read();
x++;
if(data[x-1]==0x0D&&data[x-2]=='"'){
x=0;
}
}while(!(data[x-1]=='K'&&data[x-2]=='O'));
data[x-3]='\0'; //finish the string before the OK
Serial.println(data); //shows the message
delay(5000);
}
i use this code but i dont get my message
serial monitor show nothing
Last edited: