Arduino code:
/*
code started
women safety system using by gsm
#defibe push = 2;
#define rx = tx;
#define tx = rx;
code created by technical ideas yt
https://youtube.com/c/TechnicalidEas07
*/
#include<LiquidCrystal.h>
const int rs = 3, en = 4, d4 = 5, d5 = 6, d6 = 7, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int state = 0;
const int pin = 2;
void setup()
{
lcd.begin(16,2);
lcd.setCursor(0, 0);
lcd.print("INNOVATIVE IDEAS");
lcd.setCursor(0, 1);
lcd.print("YouTube");
delay(3000);
lcd.clear();
Serial.begin(9600);
}
void loop()
{
if (digitalRead(pin) == HIGH && state == 0) {
Serial.print("\r");
delay(1000);
Serial.print("AT+CMGF=1\r");
delay(1000);
//Replace XXXXXXXXXX to 10 digit mobile number
Serial.print("AT+CMGS=\"+91XXXXXXX750\"\r");
delay(1000);
//The text of the message to be sent.
Serial.print("Please help me safe me");
lcd.setCursor(0, 0);
lcd.print(" Message ");
lcd.setCursor(0, 1);
lcd.print(" Sent ");
delay(3000);
lcd.clear();
delay(1000);
Serial.write(0x1A);
delay(1000);
state = 1;
}
if (digitalRead(pin) == LOW && state == 1) {
state = 0;
}
}
1 Comments
Can I use same code for using with Arduino Uno
ReplyDelete