Arduino SIM300 help in reading SMS

Get help, and assist others in with open source kits and running a business! Do not ask for legal advice or for consulting services in this forum, only general biz questions!

Moderators: adafruit_support_bill, adafruit

Forum rules
Get help, and assist others in with open source kits and running a business! Do not ask for legal advice or for consulting services in this forum, only general biz questions!
Locked
PallaviN
 
Posts: 1
Joined: Sun Oct 06, 2013 10:42 pm

Arduino SIM300 help in reading SMS

Post by PallaviN »

Hello,

I am new to micro controller programming.I am trying to connect SIM300 with Arduino duelmilanove ATmega168.

I was able to send SMS,call and other functions required for my project.I was even able to receive data from SIM300.Now I stuck at reading SMS from Memory.

For testing the reading part of my code is as follows:

Code: Select all

#include <SoftwareSerial.h> 
SoftwareSerial mySerial(2,3); 
const int buttonPin = 5; 
int index = 0; 
boolean stringComplete = false;  // whether the string is complete 
String inputString = ""; 
int buttonState = 0; 


void setup() { 
  // initialize serial: 
  mySerial.begin(9600); // the GPRS baud rate 
  Serial.begin(9600); 
  // reserve 200 bytes for the inputString: 
  //inputString.reserve(1200); 
   mySerial.println("AT"); 
   delay(2000); 
} 

void loop() { 
  mySerialEvent(); 
  // print the string when a newline arrives: 
  if (stringComplete) { 
    Serial.println("Loop input String = " + inputString + "..."); 
    // clear the string: 
     inputString = ""; 
    stringComplete = false; 
  } 
  
  buttonState = digitalRead(buttonPin); 
  if (buttonState == LOW) {  
      mySerial.println("AT+CMGF=1"); 
      delay(2500); 
      mySerial.print( "AT+CMGR=1" ); 
  } 
  } 


void mySerialEvent() { 
  
  while (mySerial.available()) { 
    // get the new byte: 
    char inChar = (char)mySerial.read(); 
    // add it to the inputString: 
    inputString += inChar; 
    // if the incoming character is a newline, set a flag 
    // so the main loop can do something about it: 
    if (inChar == '\n') { 
      stringComplete = true; 
    } 
  } 
  //Serial.println("Outside while inputstring=" + inputString + "..."); 
} 
 
I am able to read and get all other response but for reading SMS from memory...it keep coming out of while loop before reading the complete msg...It keep truncating the msg at time of the SMS.

Output is as follows:

Code: Select all

AT+CMGR=1 
+CMGR: "REC READ","phonenumber","","9/9/13,03:40:
Please help me resolve this issue.

Thanks,
Pallavi

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Arduino SIM300 help in reading SMS

Post by adafruit_support_mike »

I'm afraid that's not one of our products, so we don't have any in-house experience working with it.

Your best source for information would be the vendor who sold you the device in the first place. See if they have datasheets or sample code that you can use as a reference.

Locked
Forum rules
Get help, and assist others in with open source kits and running a business! Do not ask for legal advice or for consulting services in this forum, only general biz questions!

Return to “Kitbiz”