Hi to everybody,
I am quite new to arduino and need some help with a function.
i have this function:
void sendSms(String smsNumber, String smsText)
{
Serial.println("\n--- SEND SMS START ---");
digitalWrite(LED_BUILTIN, HIGH);
myGsm.write("AT+CMGF=1\r");
waitSerial("OK");
myGsm.write("AT+CMGS="+smsNumber+"\r");
waitSerial(">");
myGsm.write(smsText);
myGsm.write(0x1A);
waitSerial("OK");
Serial.println("--- SEND SMS END ---");
digitalWrite(LED_BUILTIN, LOW);
}
from another function want to use the above as sendSms("to number", "with sms text this");
can not do that, getting many errors.
First of all how do i join strings as this "AT+CMGS="+smsNumber+"\r" is wrong!
Also why Serial.Write() works ok if i put a string e.g. Serial.Write("some text"); but not if i try to use a String variable e.g. myGsm.write(smsText);
What am i doing wrong?
Thank you all in advance.