Hello guys! I'm developing a desktop application that is sending SMS messages to many people at once(over 1000 and more). Since I am new to Arduino coding, I could need some help. I used the default code for sending SMS messages, of which I deleted code I don't need. So what was left is this:
void loop() {
char remoteNum[30];
readSerial(remoteNum);
char txtMsg[500];
readSerial(txtMsg);
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
}
And this:
void loop() {
char remoteNum[30]; // telephone number to send sms
readSerial(remoteNum);
char txtMsg[500];
readSerial(txtMsg);
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
}
As far as I understand, Arduino comunicates with ports, so I created a serial port in my C# code, which loopes trough all contacts that are going to receive a SMS.
This code looks like this:
try
{
port.BaudRate = 9600;
port.PortName = "COM13";
port.Open();
}
catch {return; }
foreach (person in list)
{
string smsText = new TextRange(smsText_rtb.Document.ContentStart, smsText_rtb.Document.ContentEnd).Text;
port.WriteLine(phoneNbr);
port.WriteLine(smsText);
It seemed easy enough for me but since it doesn't work well, I am looking for an explaination for that. The thing is, that when I send 5 messages at once, sometimes only one is sent, sometimes more and many time none. I have no clue why the code is bhaving that way.
What I am trying to do is that the arduino code first accepts all numbers and then sends them once they are all received. Or is there a better solution to this? Thanks for your help, guys!