SIM900 SMS programming question

Hello all

I'm trying to read SMS data into a string. Using the UNO R3 board, and the SIM900 shield by ITead Studio.

The connection works well, incoming messages are correctly displayed on the serial monitor (AT+CNMI is set to 2,0). I'm using the library from open electronics (Google Code Archive - Long-term storage for Google Code Project Hosting.).

What I'm trying to do is create a similar method to Serial.event(), which takes incoming characters from the serial port and puts them into a string until it finds the newline character. After this it will print the string, and set it to 0:

String inputStr = "";         // a string to hold incoming data
//boolean stringComp = false;  // whether the string is complete

void setup() {
  // initialize serial:
  // reserve 200 bytes for the inputString:

void loop() {
  // print the string when a newline arrives:
  if (stringComplete) {
    // clear the string:
    inputString = "";
    stringComplete = false;

  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char); 
    // 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;

Problem is, I cannot simply change the Serial.available to _cell.available, _cell is defined in the GSM.cpp file and creating a new software serial port in the Arduino compiler causes the two to clash. I've tried a couple of methods to alter the read functions of the library but to no avail.

The SimpleRead method works well to just stream data in from the GSM module, but I can't seem to find a way to capture that data.

Here is the simpleRead method, it reads & prints one character at a time.

void SIMCOM900::SimpleRead()
	char datain;

I've also looked at using the WhileSimpleRead method, which is different only in that it waits until there are no more characters available on the serial line before printing, which can be a bit of a problem if large amounts of data are read in.

void SIMCOM900::WhileSimpleRead()
	char datain;

I should also mention that I am running 64-bit Windows 7 Ultimate with version 1.01 of the Arduino compiler.

Thanks in advance


I'm trying to read SMS data into a string. Using the UNO R3 board

Using the String class? That's just asking for trouble.