I am using a sim 808 module interfaced with arduino uno for sending message when triggered by a pin on arduino but the problem that i am encountering is that i have to manually reset the sim808 module after sending few messages as the module enters the text mode and treats the final message sending command as a text also.So, i am searching a way to edit my code so that module can be automatically reset after sending each message.
I am using AT commands for this gsm communication.
Thanks in advance
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
int val = 0;
void setup() {
// set the data rate for the ARDUINO and SoftwareSerial port
Serial.begin(9600);
mySerial.begin(9600);
pinMode(2, INPUT_PULLUP);
Serial.println("Starting the gsm communication");
mySerial.println("AT");
delay(1000);
//while ()
mySerial.println("AT+CSCS=\"GSM\"");
delay(500);
mySerial.println("AT+CMGF=1");
delay(500);
mySerial.println("AT+CMGS=\"mobile number\"");
delay(500);
mySerial.println("message");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
val = digitalRead(2);
//Serial.println(val);
if (val==0) {
mySerial.write(0x1A);
}
}