Goal: Receive SMS, and based on that message perform an action.
Issue: my IF statement does not perform action as expected, i think my issue is needing to turn the data into a string or array.
In the code below, the manuf. says the _4G.readNewSMS function is called, and then the SMS text field is stored temporarly in
_4G._buffer
. See file 4G.PNG to see what i mean.
If I text it “action” no line is printed.
//////////////////////////////////////////////
// 1. Wait for new incoming SMS
//////////////////////////////////////////////
error = _4G.readNewSMS(30000);
if (error == 0)
{
Serial.println(F("-----------------------------------"));
Serial.print(F("SMS index: "));
Serial.println(_4G._smsIndex, DEC);
Serial.print(F("SMS Stte: "));
Serial.println(_4G._smsStatus);
Serial.print(F("Phone number: "));
Serial.println(_4G._smsNumber);
Serial.print(F("SMS day: "));
Serial.println(_4G._smsDate);
Serial.print(F("SMS time: "));
Serial.println(_4G._smsTime);
Serial.print(F("SMS body: "));
Serial.println((char *)_4G._buffer);
Serial.println(F("-----------------------------------"));
if (_4G._buffer == "action " ){
Serial.println("111111111111111111");
Ser.png shows the serial monitor output with no 1111 line printed.