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

exp 3 iot lab

Uploaded by

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

exp 3 iot lab

Uploaded by

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

Exp 3

Source code

#include <SoftwareSerial.h>
SoftwareSerial sim800l(0, 1); #define button1 7 //Button pin, on the other pin it's wired with GND
bool button_State; //Button state
void setup()
{
pinMode(button1, INPUT_PULLUP);
sim800l.begin(9600);

Serial.begin(9600);
delay(1000);
}
void loop()
{
button_State = digitalRead(button1);
if (button_State == LOW) {
Serial.println("Button pressed");
delay(200);
SendSMS();

}
if (sim800l.available())

{
Serial.write(sim800l.read());
}
}
void SendSMS()
{
Serial.println("Sending SMS...");

sim800l.print("AT+CMGF=1\r");
delay(100);
sim800l.print("AT+CMGS=\"+919080659745\"\r");
delay(500);
sim800l.print("SIM800l is working
delay(500);
sim800l.print((char)26 a);
delay(500);
sim800l.println();
Serial.println("Text Sent.");
delay(500);
}
schematic:

Observation :

You might also like