0% found this document useful (0 votes)
17 views

Mess Pro

The document contains code for an Arduino sketch that allows sending and receiving SMS messages using a GSM module. The sketch defines functions for sending an SMS message on button press 's' and receiving messages on button press 'r' by issuing AT commands to the GSM module over a serial connection.

Uploaded by

naveen g
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Mess Pro

The document contains code for an Arduino sketch that allows sending and receiving SMS messages using a GSM module. The sketch defines functions for sending an SMS message on button press 's' and receiving messages on button press 'r' by issuing AT commands to the GSM module over a serial connection.

Uploaded by

naveen g
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//ERFINDER CODE

#include <SoftwareSerial.h>

SoftwareSerial mySerial(9, 10);

void setup()
{
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}

void loop()
{
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
SendMessage();
break;
case 'r':
RecieveMessage();
break;
}

if (mySerial.available()>0)
Serial.write(mySerial.read());
}

void SendMessage()
{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("I am SMS from GSM Module");// The SMS text you want to send
delay(100);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}

void RecieveMessage()
{
mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to recieve a live SMS
delay(1000);
}

You might also like