Skip to content

Commit d9cb5c9

Browse files
authored
Add files via upload
1 parent 8d26e49 commit d9cb5c9

File tree

5 files changed

+479
-0
lines changed

5 files changed

+479
-0
lines changed

examples/getTimeRTC/getTimeRTC.ino

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* This library was written by Cristian Steib.
3+
* steibkhriz@gmail.com
4+
*
5+
* Revised by:
6+
* Vittorio Esposito - https://github.com/VittorioEsposito
7+
*
8+
*
9+
* Designed to work with the GSM Sim800l.
10+
*
11+
* ENG
12+
* This library uses SoftwareSerial, you can define RX and TX pins
13+
* in the header "Sim800l.h", by default pins are RX=10 and TX=11.
14+
* Be sure that GND is connected to arduino too.
15+
* You can also change the RESET_PIN as you prefer.
16+
*
17+
* ESP
18+
* Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX
19+
* en el archivo header, "Sim800l.h", por defecto los pines vienen configurado en
20+
* RX=10 TX=11.
21+
* Tambien se puede cambiar el RESET_PIN por otro que prefiera
22+
*
23+
* ITA
24+
* Questa libreria utilizza la SoftwareSerial, si possono cambiare i pin di RX e TX
25+
* dall' intestazione "Sim800l.h", di default essi sono impostati come RX=10 RX=11
26+
* Assicurarsi di aver collegato il dispositivo al pin GND di Arduino.
27+
* E' anche possibile cambiare il RESET_PIN.
28+
*
29+
*
30+
* PINOUT:
31+
* _____________________________
32+
* | ARDUINO UNO >>> SIM800L |
33+
* -----------------------------
34+
* GND >>> GND
35+
* RX 10 >>> TX
36+
* TX 11 >>> RX
37+
* RESET 2 >>> RST
38+
*
39+
* POWER SOURCE 4.2V >>> VCC
40+
*
41+
*
42+
* SOFTWARE SERIAL NOTES:
43+
*
44+
* PINOUT
45+
* The library has the following known limitations:
46+
* 1. If using multiple software serial ports, only one can receive data at a time.
47+
* 2. Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
48+
* 3. Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
49+
* 4. On Arduino or Genuino 101 the current maximum RX speed is 57600bps
50+
* 5. On Arduino or Genuino 101 RX doesn't work on Pin 13
51+
*
52+
* BAUD RATE
53+
* Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.
54+
*
55+
*
56+
* Created on: April 20, 2016
57+
* Author: Cristian Steib
58+
* Reviser: Vittorio Esposito
59+
*
60+
*
61+
*/
62+
63+
#include <Sim800l.h>
64+
#include <SoftwareSerial.h> //This is necessary for the library
65+
66+
#define BAUD 4800 // Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.
67+
68+
Sim800l Sim800l; //To declare the library
69+
70+
int day,month,year,minute,second,hour;
71+
72+
73+
74+
void setup(){
75+
Serial.begin(9600); // Only for debug the results .
76+
Sim800l.begin(); // Initializate the library.
77+
//Sim800l.begin(BAUD); // Or choose your custom baud rate
78+
}
79+
80+
void loop(){
81+
Sim800l.RTCtime(&day,&month,&year,&hour,&minute,&second);
82+
//at this moment the variables have the real time.
83+
Serial.print(day);
84+
Serial.print('/');
85+
Serial.print(month);
86+
Serial.print('/');
87+
Serial.print(year);
88+
Serial.print(' ');
89+
Serial.print(hour);
90+
Serial.print(':');
91+
Serial.print(minute);
92+
Serial.print(':');
93+
Serial.print(second);
94+
Serial.println();
95+
}

examples/readSms/readSms.ino

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* This library was written by Cristian Steib.
3+
* steibkhriz@gmail.com
4+
*
5+
* Revised by:
6+
* Vittorio Esposito - https://github.com/VittorioEsposito
7+
*
8+
*
9+
* Designed to work with the GSM Sim800l.
10+
*
11+
* ENG
12+
* This library uses SoftwareSerial, you can define RX and TX pins
13+
* in the header "Sim800l.h", by default pins are RX=10 and TX=11.
14+
* Be sure that GND is connected to arduino too.
15+
* You can also change the RESET_PIN as you prefer.
16+
*
17+
* ESP
18+
* Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX
19+
* en el archivo header, "Sim800l.h", por defecto los pines vienen configurado en
20+
* RX=10 TX=11.
21+
* Tambien se puede cambiar el RESET_PIN por otro que prefiera
22+
*
23+
* ITA
24+
* Questa libreria utilizza la SoftwareSerial, si possono cambiare i pin di RX e TX
25+
* dall' intestazione "Sim800l.h", di default essi sono impostati come RX=10 RX=11
26+
* Assicurarsi di aver collegato il dispositivo al pin GND di Arduino.
27+
* E' anche possibile cambiare il RESET_PIN.
28+
*
29+
*
30+
* PINOUT:
31+
* _____________________________
32+
* | ARDUINO UNO >>> SIM800L |
33+
* -----------------------------
34+
* GND >>> GND
35+
* RX 10 >>> TX
36+
* TX 11 >>> RX
37+
* RESET 2 >>> RST
38+
*
39+
* POWER SOURCE 4.2V >>> VCC
40+
*
41+
*
42+
* SOFTWARE SERIAL NOTES:
43+
*
44+
* PINOUT
45+
* The library has the following known limitations:
46+
* 1. If using multiple software serial ports, only one can receive data at a time.
47+
* 2. Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
48+
* 3. Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
49+
* 4. On Arduino or Genuino 101 the current maximum RX speed is 57600bps
50+
* 5. On Arduino or Genuino 101 RX doesn't work on Pin 13
51+
*
52+
* BAUD RATE
53+
* Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.
54+
*
55+
*
56+
* Created on: April 20, 2016
57+
* Author: Cristian Steib
58+
* Reviser: Vittorio Esposito
59+
*
60+
*
61+
*/
62+
63+
#include <Sim800l.h>
64+
#include <SoftwareSerial.h> // This is necesary for the library
65+
Sim800l Sim800l; // to declare the library
66+
String text; // to save the text of the sms
67+
uint8_t index; // to indicate the message to read.
68+
69+
70+
void setup(){
71+
Serial.begin(9600); // only for debug the results .
72+
Sim800l.begin(); // initializate the library.
73+
index=1; // first position in the prefered memory storage.
74+
text=Sim800l.readSms(index);
75+
Serial.println(text);
76+
77+
}
78+
79+
void loop(){
80+
//do nothing
81+
}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/*
2+
* This library was written by Cristian Steib.
3+
* steibkhriz@gmail.com
4+
*
5+
* Revised by:
6+
* Vittorio Esposito - https://github.com/VittorioEsposito
7+
*
8+
*
9+
* Designed to work with the GSM Sim800l.
10+
*
11+
* ENG
12+
* This library uses SoftwareSerial, you can define RX and TX pins
13+
* in the header "Sim800l.h", by default pins are RX=10 and TX=11.
14+
* Be sure that GND is connected to arduino too.
15+
* You can also change the RESET_PIN as you prefer.
16+
*
17+
* ESP
18+
* Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX
19+
* en el archivo header, "Sim800l.h", por defecto los pines vienen configurado en
20+
* RX=10 TX=11.
21+
* Tambien se puede cambiar el RESET_PIN por otro que prefiera
22+
*
23+
* ITA
24+
* Questa libreria utilizza la SoftwareSerial, si possono cambiare i pin di RX e TX
25+
* dall' intestazione "Sim800l.h", di default essi sono impostati come RX=10 RX=11
26+
* Assicurarsi di aver collegato il dispositivo al pin GND di Arduino.
27+
* E' anche possibile cambiare il RESET_PIN.
28+
*
29+
*
30+
* PINOUT:
31+
* _____________________________
32+
* | ARDUINO UNO >>> SIM800L |
33+
* -----------------------------
34+
* GND >>> GND
35+
* RX 10 >>> TX
36+
* TX 11 >>> RX
37+
* RESET 2 >>> RST
38+
*
39+
* POWER SOURCE 4.2V >>> VCC
40+
*
41+
*
42+
* SOFTWARE SERIAL NOTES:
43+
*
44+
* PINOUT
45+
* The library has the following known limitations:
46+
* 1. If using multiple software serial ports, only one can receive data at a time.
47+
* 2. Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
48+
* 3. Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
49+
* 4. On Arduino or Genuino 101 the current maximum RX speed is 57600bps
50+
* 5. On Arduino or Genuino 101 RX doesn't work on Pin 13
51+
*
52+
* BAUD RATE
53+
* Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.
54+
*
55+
*
56+
* Created on: April 20, 2016
57+
* Author: Cristian Steib
58+
* Reviser: Vittorio Esposito
59+
*
60+
*
61+
*/
62+
63+
#include <Sim800l.h>
64+
#include <SoftwareSerial.h> //is necesary for the library!!
65+
Sim800l Sim800l; //to declare the library
66+
67+
68+
69+
String textSms,numberSms;
70+
uint8_t index1;
71+
uint8_t LED2=13; // use what you need
72+
bool error;
73+
74+
75+
76+
void setup(){
77+
78+
pinMode(LED2,OUTPUT);
79+
digitalWrite(LED2,HIGH);
80+
81+
Serial.begin(9600); // only for debug the results .
82+
Sim800l.begin(); // initializate the library.
83+
Sim800l.reset();
84+
//don't forget to catch the return of the function delAllSms!
85+
error=Sim800l.delAllSms(); //clean memory of sms;
86+
87+
}
88+
89+
void loop(){
90+
textSms=Sim800l.readSms(1); //read the first sms
91+
92+
if (textSms.indexOf("OK")!=-1) //first we need to know if the messege is correct. NOT an ERROR
93+
{
94+
if (textSms.length() > 7) // optional you can avoid SMS empty
95+
{
96+
97+
numberSms=Sim800l.getNumberSms(1); // Here you have the number
98+
//for debugin
99+
Serial.println(numberSms);
100+
textSms.toUpperCase(); // set all char to mayus ;)
101+
102+
if (textSms.indexOf("TURNON")!=-1){
103+
Serial.println("LED TURN ON");
104+
digitalWrite(LED2,1);
105+
}
106+
else if (textSms.indexOf("TURNOFF")!=-1){
107+
Serial.println("LED TURN OFF");
108+
digitalWrite(LED2,0);
109+
110+
}
111+
else{
112+
Serial.println("Not Compatible ...sorry.. :D");
113+
}
114+
115+
116+
Sim800l.delAllSms(); //do only if the message is not empty,in other case is not necesary
117+
//delete all sms..so when receive a new sms always will be in first position
118+
}
119+
120+
121+
122+
}
123+
}
124+

examples/sendSms/sendSms.ino

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* This library was written by Cristian Steib.
3+
* steibkhriz@gmail.com
4+
*
5+
* Revised by:
6+
* Vittorio Esposito - https://github.com/VittorioEsposito
7+
*
8+
*
9+
* Designed to work with the GSM Sim800l.
10+
*
11+
* ENG
12+
* This library uses SoftwareSerial, you can define RX and TX pins
13+
* in the header "Sim800l.h", by default pins are RX=10 and TX=11.
14+
* Be sure that GND is connected to arduino too.
15+
* You can also change the RESET_PIN as you prefer.
16+
*
17+
* ESP
18+
* Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX
19+
* en el archivo header, "Sim800l.h", por defecto los pines vienen configurado en
20+
* RX=10 TX=11.
21+
* Tambien se puede cambiar el RESET_PIN por otro que prefiera
22+
*
23+
* ITA
24+
* Questa libreria utilizza la SoftwareSerial, si possono cambiare i pin di RX e TX
25+
* dall' intestazione "Sim800l.h", di default essi sono impostati come RX=10 RX=11
26+
* Assicurarsi di aver collegato il dispositivo al pin GND di Arduino.
27+
* E' anche possibile cambiare il RESET_PIN.
28+
*
29+
*
30+
* PINOUT:
31+
* _____________________________
32+
* | ARDUINO UNO >>> SIM800L |
33+
* -----------------------------
34+
* GND >>> GND
35+
* RX 10 >>> TX
36+
* TX 11 >>> RX
37+
* RESET 2 >>> RST
38+
*
39+
* POWER SOURCE 4.2V >>> VCC
40+
*
41+
*
42+
* SOFTWARE SERIAL NOTES:
43+
*
44+
* PINOUT
45+
* The library has the following known limitations:
46+
* 1. If using multiple software serial ports, only one can receive data at a time.
47+
* 2. Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
48+
* 3. Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
49+
* 4. On Arduino or Genuino 101 the current maximum RX speed is 57600bps
50+
* 5. On Arduino or Genuino 101 RX doesn't work on Pin 13
51+
*
52+
* BAUD RATE
53+
* Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200.
54+
*
55+
*
56+
* Created on: April 20, 2016
57+
* Author: Cristian Steib
58+
* Reviser: Vittorio Esposito
59+
*
60+
*
61+
*/
62+
63+
#include <Sim800l.h>
64+
#include <SoftwareSerial.h> //is necesary for the library!!
65+
Sim800l Sim800l; //to declare the library
66+
char* text;
67+
char* number;
68+
bool error; //to catch the response of sendSms
69+
70+
71+
void setup(){
72+
Sim800l.begin(); // initializate the library.
73+
text="Testing Sms"; //text for the message.
74+
number="2926451386"; //change to a valid number.
75+
error=Sim800l.sendSms(number,text);
76+
// OR
77+
//Sim800l.sendSms("+540111111111","the text go here")
78+
79+
80+
}
81+
82+
void loop(){
83+
//do nothing
84+
}

0 commit comments

Comments
 (0)