I guess the SMS code you got there should work, but I know this one does work
int sendMessage(const char* telNr, const char* msg)
{
int ret;
if (!strlen(telNr)) return -1;
if (!Cellular.ready())
{
Cellular.on();
Cellular.connect();
if (!waitFor(Cellular.ready, 300000))
{
Log.warn("no radio connection");
return -1;
}
}
ret = Cellular.command("AT+CMGF=1\r\n");
ret = Cellular.command("AT+CMGS=\"%s%s\",145\r\n", (telNr[0] != '+') ? "+" : "", telNr);
ret = Cellular.command("%s\x1a", msg);
switch (ret)
{
case WAIT:
Log.info("WAITING, but probably");
case RESP_OK:
Log.info("Sent: '%s' to %s", msg, telNr);
break;
default:
Log.warn("Message not sent (%d)", ret);
break;
}
return ret;
}
But you need an SMS enabled SIM and set the APN and Particle.keepAlive()
correctly
You can also try INPUT_PULLDOWN
and remove your external pull-down.
And add some Serial.print()
statements to show the buttonState