Hi
I want to send a message to the arduino by serial or by udp. This message contains a telephone and a text.
After receiving it, the arduino sends an SMS through an A6 gsm card and also that the arduino makes a call to the telephone of the message.
this example works well for the call and the sending of sms
char phone_no[]="8293353345";
char caracter;
String comando;
void setup() {
Serial.begin(9600);
delay(300);
Serial.println("AT+CMGF=1");
delay(2000);
Serial.print("AT+CMGS=\"");
Serial.print(phone_no);
Serial.write(0x22);
Serial.write(0x0D); // hex equivalent of Carraige return
Serial.write(0x0A); // hex equivalent of newline
delay(2000);
Serial.print("GSM A6 test message!");
delay(500);
Serial.println (char(26));//the ASCII code of the ctrl+z is 26
delay(10000);
Serial.println("AT");
delay(1000);
Serial.print("ATD");
Serial.println(phone_no);
//Serial.println(";");
delay(20000);
Serial.println("ATH");
}
void loop()
{
}
I want to use other pins for the connection of the A6 gsm module, but I can not get it to work. I have tried with this code:
#include <SoftwareSerial.h>
SoftwareSerial A6Module(18,19); //RX,TX
char input='\0';
void setup() {
A6Module.begin(115200);
Serial.begin(9600);
delay(500);
}
void loop()
{
if (Serial.available() > 0) {
input = Serial.read();
}
if (input == 't') {
sendMSM();
input = '\0';
} else if (input == 'c') {
makeCall();
input = '\0';
}
}
void sendMSM() {
A6Module.println("AT+CMGF=1");
delay(2000);
A6Module.print("AT+CMGS=\"8293353345");
A6Module.print(char(34)); // "
A6Module.print(char(13)); // CR
A6Module.print('\r'); // hex equivalent of newline
delay(2000);
A6Module.print("Prueba Compu");
delay(500);
A6Module.println (char(26)); //ctrl_z
}
void makeCall() {
A6Module.println("ATD+8293353345");
delay(20000);
A6Module.println("ATH"); //end call
}
I can use a mega arduino with an ethernet shield or a wemos d1.
Some idea of how to do what I need.
the connections of the module A6 gsm with the arduino are:
RX from A6 to TX from arduino
TX from the A6 to the RX of the arduio
GND from A6 to GND from arduino
PWR from A6 to vcc from A6
I hope you can help me