user3761: I have a SIM900 module and Arduino, both are working fine. In my previous programs I have use strstr() command to find specific word from a string but they were constants and pre defined in the program but now I want to read serial communication from SIM900 and detect a specific word from it. But it is showing me 

invalid conversion from 'char' to 'const char'

This is my program:
int x;
char sms;
char response;
char disp;
void setup()
{
  Serial.begin(2400);
}


void loop() {
  while(Serial.available() == 0);

  if(Serial.available() > 0)
  {    
    sms = Serial.read();

    disp = sms;
    if (strstr(disp,"track")) //Comparing word entered with word stored in program
    {
      Serial.println("Found the  word!");
    }
  }
}


user60: There are two problems. 
1) you are trying to have the Arduino's single UART talk to both the SIM900 and the PC. 
2) disp needs to be an array of char's, as to compare for words phrases.
Try the following. It implements a 2nd Soft serial port to which you can connect the SIM900. Along with building an array char at a time.
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

char buffer[16];
#define buffer_size sizeof(buffer)/sizeof(buffer[0])
int8_t buffer_pos = 0;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("Serial to mySerial demo started");

  buffer_pos = 0;
}

void loop() {
  char inByte;
  while (mySerial.available()) {
    inByte = mySerial.read();
    while (buffer_pos >= buffer_size) {
      for (int8_t i = 0; i < buffer_size - 1; i++) { // if shift buff left if at end of buff
        buffer[i] = buffer[i + 1];
      }
      buffer_pos--;
    }
    buffer[buffer_pos++] = inByte;
    if (strcasestr(buffer, "track")) {
      buffer_pos = 0;
      Serial.println("TRACK FOUND!");
    } else {
      Serial.write(inByte);
    }
  }
}


3761: <p>I have a SIM900 module and Arduino, both are working fine. In my previous programs I have use strstr() command to find specific word from a string but they were constants and pre defined in the program but now I want to read serial communication from SIM900 and detect a specific word from it. But it is showing me </p>

<blockquote>
  <p>invalid conversion from 'char' to 'const char'</p>
</blockquote>

<p>This is my program:</p>

<pre><code>int x;
char sms;
char response;
char disp;
void setup()
{
  Serial.begin(2400);
}


void loop() {
  while(Serial.available() == 0);

  if(Serial.available() &gt; 0)
  {    
    sms = Serial.read();

    disp = sms;
    if (strstr(disp,"track")) //Comparing word entered with word stored in program
    {
      Serial.println("Found the  word!");
    }
  }
}
</code></pre>
 60: <p>There are two problems. </p>

<p>1) you are trying to have the Arduino's single UART talk to both the SIM900 and the PC. </p>

<p>2) disp needs to be an array of char's, as to compare for words phrases.</p>

<p>Try the following. It implements a 2nd Soft serial port to which you can connect the SIM900. Along with building an array char at a time.</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;

SoftwareSerial mySerial(10, 11); // RX, TX

char buffer[16];
#define buffer_size sizeof(buffer)/sizeof(buffer[0])
int8_t buffer_pos = 0;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("Serial to mySerial demo started");

  buffer_pos = 0;
}

void loop() {
  char inByte;
  while (mySerial.available()) {
    inByte = mySerial.read();
    while (buffer_pos &gt;= buffer_size) {
      for (int8_t i = 0; i &lt; buffer_size - 1; i++) { // if shift buff left if at end of buff
        buffer[i] = buffer[i + 1];
      }
      buffer_pos--;
    }
    buffer[buffer_pos++] = inByte;
    if (strcasestr(buffer, "track")) {
      buffer_pos = 0;
      Serial.println("TRACK FOUND!");
    } else {
      Serial.write(inByte);
    }
  }
}
</code></pre>
