Char Comparision

Hello

Iam new here , and Iam begginer....

I try build LED indicator of GSM signal strenght , when I send AT+CSQ command:

AT+CSQ

Answer: 

+CSQ: 23,0
OK

The code is:

#define PINNUMBER "1111"
#define led 7 //blue
#define led2 8 //green

char buffer[256];
String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete
int inChar = 0;
int incomingByte = 0;


void setup() {
  Serial.begin(9600);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  inputString.reserve(200);
  start_GSM();
}



void loop() {

  Serial.println("AT+CSQ");
  delay(100);

  if (stringComplete) {
    digitalWrite(led, LOW);
    delay(50);
    digitalWrite(led, HIGH);
    inputString = "";
    stringComplete = false;
    delay(2000);
  }
}


void serialEvent() {
  while (Serial.available()) {
    char inChar = (char)Serial.read();
    inputString += inChar;
    if (inChar == '+') {
      stringComplete = true;
    }
  }
}



void start_GSM() {
  {
    digitalWrite(led, HIGH);
    digitalWrite(led2, HIGH);
  }
  Serial.println("AT");
  delay(1000);
  Serial.println("AT+CMGF=1");
  delay(500);
  Serial.println("AT+CREG?");
  delay(1000);
  Serial.println("ATE0");
  delay(500);
  Serial.println("AT+CMGR=1");
  delay(500);
}

Is good idea to use SerialEvent ? this function working on interrups ?

So many Thanks for any idea... and help.

Best Regards Chriss

A couple of starting suggestions:

First, use Ctrl-T when you have your source code in the IDE before posting. It places it in a standard C format, which makes it easier for us to read your code.

Second, the statement:

    if (inChar == '+CSQ: 23,0') { //Led blink when I put + only charter here

can't work because inChar is a single character, but you're comparing it against a string of 10 characters.

Third, what is the mechanism for getting serialEvent() to be called?

 if (inChar == '+CSQ: 23,0') { //Led blink when I put + only charter here

Single quotes are for single characters. Please post a picture of your keyboard with the +CSQ: 23,0 key circled.

Is good idea to use SerialEvent ?

It's neither good or bad. It is good in that the processing of serial data happens in one function. It is bad in that apparently you don't understand when the function is called.

this function working on interrups ?

No. The function is called at the end of loop() if it is defined AND there is serial data to process.

Why bother to collect the data in a String if you never use the String?

Hello

Thanks for fast replay....

Here is attachment from Terminal:

http://postimg.org/image/ocrhut1uv/

Regards Chriss

Here is attachment from Terminal:

A picture of some text. I won't even bother.