this sketch reads incoming sms's and stores it perfectly,the stored sms doesnt show the contents of it,the word 'on' doesnt appear anywhere on the serial monitor only the cellphone number and some other details,according to the sketch it should activate the led when an sms 'on' is sent,i checked all AT commands they seem to be right,not sure how to modify the part that is responsible for reading the sms,
The is NOT code. Learn how to post comments OUTSIDE of the code tags.
if(Serial.available())
else if(mySerial.available())
Why are these exclusive?
char SerialInByte;
SerialInByte = (unsigned char)mySerial.read();
Why are you separating the declaration and the initialization?
char SerialInByte = (unsigned char)mySerial.read();
Casting to an unsigned char to store in a signed char is a bad idea, by the way. The cast is not needed at all.
// FR: Si le message se termine par un <CR> alors traiter le message
if( SerialInByte == 13 ){
Why not make it clear what the code is doing?
if( SerialInByte == '\n' ){
If you can add a space after the open parenthesis, why can't you add one after the close parenthesis? Studying the code every time is a waste of time. Organize the code so it is readable.
if( SerialInByte == 10 ){
// EN: Skip Line feed
Again, why not make the code clearer?
if( SerialInByte == '\r' ) {
msg += String(SerialInByte);
Invoking the constructor, the copy constructor, the assignment operator, and the destructor for the String class to add one character is a waste of resources. The += operator is overloaded to add a character. Use that overload instead of converting the one character to a new String.
In fact, you should get rid of the String class, altogether.
Anyway, none of this has anything to do with why the AT commands are not returning entirely what you expect. That doesn't mean that they should not be fixed. What it tells me is that you are issuing the wrong AT command to read the SMS.