File tree 5 files changed +58
-0
lines changed
Interfacing SIM800L with ESP32 5 files changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ void setup () {
3
+ Serial.begin (9600 );
4
+ Serial2.begin (9600 );
5
+ delay (3000 );
6
+ test_sim800_module ();
7
+ send_SMS ();
8
+ }
9
+
10
+ void loop () {
11
+ updateSerial ();
12
+ }
13
+
14
+
15
+ void test_sim800_module ()
16
+ {
17
+ Serial2.println (" AT" );
18
+ updateSerial ();
19
+ Serial.println ();
20
+ Serial2.println (" AT+CSQ" );
21
+ updateSerial ();
22
+ Serial2.println (" AT+CCID" );
23
+ updateSerial ();
24
+ Serial2.println (" AT+CREG?" );
25
+ updateSerial ();
26
+ Serial2.println (" ATI" );
27
+ updateSerial ();
28
+ Serial2.println (" AT+CBC" );
29
+ updateSerial ();
30
+ }
31
+
32
+
33
+ void updateSerial ()
34
+ {
35
+ delay (500 );
36
+ while (Serial.available ())
37
+ {
38
+ Serial2.write (Serial.read ());// Forward what Serial received to Software Serial Port
39
+ }
40
+ while (Serial2.available ())
41
+ {
42
+ Serial.write (Serial2.read ());// Forward what Software Serial received to Serial Port
43
+ }
44
+ }
45
+
46
+
47
+ void send_SMS ()
48
+ {
49
+ Serial2.println (" AT+CMGF=1" ); // Configuring TEXT mode
50
+ updateSerial ();
51
+ Serial2.println (" AT+CMGS=\" +919804049270\" " );// change ZZ with country code and xxxxxxxxxxx with phone number to sms
52
+ updateSerial ();
53
+ Serial2.print (" Circuit Digest" ); // text content
54
+ updateSerial ();
55
+ Serial.println ();
56
+ Serial.println (" Message Sent" );
57
+ Serial2.write (26 );
58
+ }
You can’t perform that action at this time.
0 commit comments