Go Down

Topic: add multiple recipients in mkr gsm 1400 (Read 127 times) previous topic - next topic

madhusudanjadhav79

Hi There,
How to add Multiple reciepents in MKR GSM 1400.

PaulS

Hi There,
How to add Multiple reciepents in MKR GSM 1400.

Add them to what? What library are you using to send text messages? Is that library constructed to send to more than one person at a time?

The usual solution is to use a for loop, and send one message, to one person/phone number, at a time.
The art of getting good answers lies in asking good questions.

madhusudanjadhav79

Hi there ,
I am Using MKRGSM library.
 I have written like this
 sms.beginSMS(num);
  sms.print(txtMsg);
  delay(1000);
  sms.beginSMS(numb);
  sms.print(txtMsg);
  sms.endSMS();

But SMS isnot going. I tried

  sms.beginSMS(numb);
  sms.print(txtMsg);
 sms.begin(num);
sms.print(txtMsg);
  sms.endSMS();


sms.beginSMS(num);
  sms.print(txtMsg);
  sms.endSMS();

sms.beginSMS(numb);
  sms.print(txtMsg);
sms.endSMS();

sms.beginSMS(num);
  sms.print(txtMsg);
  sms.endSMS();
delay(2000);
sms.beginSMS(numb);
  sms.print(txtMsg);
sms.endSMS();

but proceesor stucks at program. in sms.begin.

PaulS

Quote
I have written like this
Why? Begin sending an SMS. Include some text in the message. Stuff your thumb up your ass for a while. Then, start over sending an SMS. That makes no sense.

Quote
but proceesor stucks at program. in sms.begin.
The processor does not "stucks".

Post ALL of your real code, properly indented, in code tags, or all you will get is snippets of answers.
The art of getting good answers lies in asking good questions.

madhusudanjadhav79

#4
Jun 25, 2019, 05:27 pm Last Edit: Jun 25, 2019, 06:21 pm by madhusudanjadhav79 Reason: forgot to put the code tag
Hi Paul,
I am NewBee!!!
please see the below code. I am not able to send sms to two recipients.
Code: [Select]
#include "arduino.h"
#include <MKRGSM.h>
#define PINNUMBER ""


#define HIGH 1
#define LOW 0


// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;
int a1 =1;
int  b1 =2;
int c1= 3;
int d1= 4;
int e1= 5;
int f1= 7;
int g1= 8;
int h1= 0;
int a = 0;
int b = 0;
int c =0;
int d = 0;
int e =0;
int f =0;
int g = 0;
int h =0;
int i=0;

void gsm();
void gsm(){
 char *txtMsg;
 char num[11] = {"............."}; //number 1 recipient number//
char numb[11]={".............."}; // number 2 recipient number//
// //
 if(a == false)
 // sms text
{

 
 Serial.print("Now, enter SMS content:1 ");

txtMsg= {"Hi there"};
 
 Serial.println("SENDING");
 Serial.println();
 Serial.println("Message:");
 Serial.println(txtMsg);

 // send the message
 sms.beginSMS(num);
 sms.print(txtMsg);
 delay(1000);
 sms.beginSMS(numb);
 sms.print(txtMsg);
 sms.endSMS();

 
 Serial.println("\nCOMPLETE!\n");
 delay(60000);
 return;
}
}
void setup() {

 pinMode(a1, INPUT);
 pinMode(b1, INPUT);
 pinMode(c1, INPUT);
 pinMode(d1,INPUT);
 pinMode(e1, INPUT);
 pinMode(f1,INPUT);
 pinMode(g1, INPUT);
 pinMode(h1, INPUT);

 digitalWrite(a1, HIGH);
 digitalWrite(c1, HIGH);
 digitalWrite(b1, HIGH);
 digitalWrite(e1, HIGH);
 digitalWrite(d1, HIGH);
 digitalWrite(f1, HIGH);
 digitalWrite(g1, HIGH);
 digitalWrite(h1, HIGH);
 // put your setup code here, to run once:
Serial.begin(9600);
 while (!Serial) {
   ; // wait for serial port to connect. Needed for native USB port only
 }

 Serial.println("SMS Messages Sender");

 // connection state
 bool connected = false;

 // Start GSM shield
 // If your SIM has PIN, pass it as a parameter of begin() in quotes
 while (!connected) {
   if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
     connected = true;
   } else {
     Serial.println("Not connected");
     delay(1000);
   }
 }

 Serial.println("GSM initialized");
 
}

void loop() {


a= digitalRead(a1);

b = digitalRead(b1);

c = digitalRead(c1);

d = digitalRead(d1);

e = digitalRead(e1);

f = digitalRead(f1);

g = digitalRead(g1);

h = digitalRead(h1);



gsm();

}

srnet

I am NewBee!!!
A good start would be to read the post called;

How to use this forum - please read

At the top of the forum.

$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

Go Up