#include<WiFi.h>
#include <ThingESP.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(22, 23);
ThingESP32 thing("HimBha","AlertMessage","1234567890");
int Button = 15;
void setup() {
// put your setup code here, to run once:
mySerial.begin(115200);
Serial.begin(115200);
Serial.println("Initializing...");
delay(1000);
mySerial.println("Attention"); // Sends an ATTENTION command, reply should be OK
mySerial.println("AT+CMGF=1"); // Configuration for sending SMS
//.............
// For whatsapp begin
pinMode(Button,INPUT);
thing.SetWiFi("ASUS_X00T","Phone1234");
thing.initDevice();
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(Button) == HIGH){
sendSMS(); // For sending message
String msg1 = "Help I am in an Emergency \n For my location go to the site - https://thingesp.siddhesh.me/#/console/project/AlertMessage \n There you login - \n Username - HimBha \n Password - P9w8UTP6SFcnE3W";
thing.sendMsg("+917250254807",msg1);
Serial.println("Message send");
}
thing.Handle();
}
void sendSMS(){
mySerial.println("AT+CMGF=1");
delay(500);
mySerial.println("AT+CMGS=\"+917250254807\"\r");
delay(500);
mySerial.print("Emergeny!!Track my number");
delay(1000);
mySerial.write(26);
}
Comments