SEND SMS USING ARDUINO AND GSM
fig1; proteus simulation
PROGRAM
Send message when a button is pressed
const int SENSORPIN = 2;
void SendMessage()
{
Serial.print("AT+CMGF=1");
Serial.write(0x0D);
delay(2000);
Serial.print("AT+CMGS=");
Serial.write(0x22);
Serial.print("974668xxxx");
Serial.write(0x22);
Serial.write(0x0D);
delay(2000);
Serial.print(" POLLUTION DETECTED ");
Serial.write(0x1A);
delay(3000);
}
int SENSORSTATE = 0;
void setup() {
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
pinMode(SENSORSTATE, INPUT);
}
void loop() {
SENSORSTATE = digitalRead(SENSORPIN);
if (SENSORSTATE == HIGH) {
while(digitalRead(SENSORPIN)== HIGH);
SendMessage();
}
}
PROGRAM
Send message to two different NO, when a button is pressed
const int SENSORPIN = 5;
void SendSMS()
{
Serial.print("AT+CMGF=1");
Serial.write(0x0D);
delay(2000);
Serial.print("AT+CMGS=");
Serial.write(0x22);
Serial.print("90483163xx");
Serial.write(0x22);
Serial.write(0x0D);
delay(2000);
Serial.print(" WARNING! ");
Serial.print("POLLUTION DETECTED");
Serial.write(0x1A);
delay(3000);
}
void SendMessage()
{
Serial.print("AT+CMGF=1");
Serial.write(0x0D);
delay(2000);
Serial.print("AT+CMGS=");
Serial.write(0x22);
Serial.print("97466831xx");
Serial.write(0x22);
Serial.write(0x0D);
delay(2000);
Serial.print(" POLLUTION DETECTED ");
Serial.write(0x1A);
delay(3000);
}
int SENSORSTATE = 0;
void setup() {
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
pinMode(SENSORSTATE, INPUT);
}
void loop() {
SENSORSTATE = digitalRead(SENSORPIN);
if (SENSORSTATE == HIGH)
{
while(digitalRead(SENSORPIN)== HIGH);
SendMessage();
SendSMS();
}
}
const int SENSORPIN = 5;
void SendSMS()
{
Serial.print("AT+CMGF=1");
Serial.write(0x0D);
delay(2000);
Serial.print("AT+CMGS=");
Serial.write(0x22);
Serial.print("90483163xx");
Serial.write(0x22);
Serial.write(0x0D);
delay(2000);
Serial.print(" WARNING! ");
Serial.print("POLLUTION DETECTED");
Serial.write(0x1A);
delay(3000);
}
void SendMessage()
{
Serial.print("AT+CMGF=1");
Serial.write(0x0D);
delay(2000);
Serial.print("AT+CMGS=");
Serial.write(0x22);
Serial.print("97466831xx");
Serial.write(0x22);
Serial.write(0x0D);
delay(2000);
Serial.print(" POLLUTION DETECTED ");
Serial.write(0x1A);
delay(3000);
}
int SENSORSTATE = 0;
void setup() {
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
pinMode(SENSORSTATE, INPUT);
}
void loop() {
SENSORSTATE = digitalRead(SENSORPIN);
if (SENSORSTATE == HIGH)
{
while(digitalRead(SENSORPIN)== HIGH);
SendMessage();
SendSMS();
}
}
No Deposit Casino | Claim Welcome Bonus Now!
ReplyDeleteNo deposit 군포 출장마사지 casinos can be 개집 왕 an exciting 김해 출장안마 alternative to traditional gambling. They let you play casino games for free and win real 김해 출장안마 money. 양산 출장마사지