-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSIM7100_SMS.ino
69 lines (56 loc) · 1.58 KB
/
SIM7100_SMS.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* ======================================================================
Project: 4G LTE SIMCOM Shield
Function: SMS
GPIO: None
Description: This example sketch allows your device to send SMS without any library,
you can change AT command for your own test.
Software: Developed by Arduino 1.8.9 software
Hardware: ESP8266-12E, SIM7100
Last Updated: 10/15/2019
Author: Ali Morawej
Github: https://github.com/alimorawej/4G-LTE-SIMcom-Shield
License: Free
Comments:
====================================================================== */
int State = HIGH;
void setup(){
Serial.begin(115200); // Setting the baud rate of Serial Monitor
while (!Serial) {
; // wait for serial port to connect. Needed for Native USB only
}
// Serial.println(F("welcome goes here!"));
}
void loop()
{
Serial.println(F("AT"));
delay(5000);
if(State == HIGH)
{
sendsms();
delay(10000);
}
}
void sendsms()
{
Serial.println("AT\r");
waitForResponse();
Serial.println("AT+CMGF=1\r");
waitForResponse();
Serial.println("AT+CPMS=\"ME\",\"ME\",\"ME\"\r");
waitForResponse();
Serial.println("AT+CNMI=2,1\r");
waitForResponse();
Serial.println("AT+CMGS=\"+1604xxxxxx\"\r");
waitForResponse();
Serial.println("Hello for SIM7100");
waitForResponse();
Serial.println((char)26); // ASCII code of CTRL+Z
delay(100);
}
void waitForResponse() {
delay(3000);
while (Serial.available()) {
Serial.read();
}
Serial.write("\n");
}