• Announcements

    • bluehash

      Forum Upgrade   03/11/2017

      Hello Everyone, Thanks for being patient while the forums were being fixed and upgraded. Please see details and report issues in this thread. Thanks!
shailav619

Interfacing msp430g2553 with gsm sim900

3 posts in this topic

Hello,

I am using msp430g2553 mcu and I interfaced that mcu with gsm sim900 successfully. Now I am facing some strange behavior in the code.

When I write the loop as follows:

void loop()
{
  String buffer = readSIM900A();
  String msgOn = buffer;
  String number1 = "8320389582"; //problem
  String number2 = "9106555707"; //problem
  String number3 = "9979933498"; //problem

    if (buffer.startsWith("\r\n+CMT: "))
    {
         Serial.println(buffer);
           buffer.remove(0,12);
           buffer.remove(10);
           Serial.println(buffer);
           msgOn.remove(0,51);
           msgOn.remove(3);
           Serial.println(msgOn);   
       if(((buffer==number1)||(buffer==number2)||(buffer==number3))&&((msgOn=="On")||(msgOn=="ON")||(msgOn=="on")))
       {
            digitalWrite(led, HIGH);
        }

 

    }

    delay(100);

 
}

In the lines above commented with "problem":

-> When I write String number1 = "8320389582"; //problem like this and when I use this for toggling led like this

if(((buffer==number1)||(buffer==number2)||(buffer==number3))&&((msgOn=="On")||(msgOn=="ON")||(msgOn=="on")))
       {
            digitalWrite(led, HIGH);
        }

This doesnt work but instead when I use the code like

if(((buffer=="+91963xxxx")||(buffer=="+91963XXXX")||(buffer=="+918753XXX"))&&((msgOn=="On")||(msgOn=="ON")||(msgOn=="on")))
       {
            digitalWrite(led, HIGH);
        }

This works and I can toggle the led.

According to my understanding there is some compiler issue in this related to memory for local loop.

Can anyone help me with this?

I am attaching my code for reference.

Thanks,

Shailav

 

 

 

 

prefinal.rar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now