Skip to content

Fix blank phone number and SMS text on return from GetSMS() #2

@sponsoredlinks

Description

@sponsoredlinks

Using the GSM_Shield_Test sketch the returned number and message text are null from GetSMS - looking into this it seems the retrieve message command needs the position to be sent as a string rather than as the value itself. I'm not sure if this is the best arduino way of doing this, but a sample fix is as below:

char GSM::GetSMS(.)
...
//send "AT+CMGR=X" - where X = position
mySerial.write("AT+CMGR=");
char posArray[4];
itoa(position, posArray, 10);
mySerial.write(posArray); // was : mySerial.write((int)position)
mySerial.write("\r");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions