|
1 | | -/* |
2 | | - * This library was written by Vittorio Esposito |
3 | | - * https://github.com/VittorioEsposito |
4 | | - * |
5 | | - * Designed to work with the GSM Sim800L. |
6 | | - * |
7 | | - * ENG |
8 | | - * This library uses SoftwareSerial, you can define RX and TX pins |
9 | | - * in the header "Sim800L.h", by default pins are RX=10 and TX=11. |
10 | | - * Be sure that GND is connected to arduino too. |
11 | | - * You can also change the RESET_PIN as you prefer. |
12 | | - * |
13 | | - * ESP |
14 | | - * Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX |
15 | | - * en el archivo header, "Sim800L.h", por defecto los pines vienen configurado en |
16 | | - * RX=10 TX=11. |
17 | | - * Tambien se puede cambiar el RESET_PIN por otro que prefiera |
18 | | - * |
19 | | - * ITA |
20 | | - * Questa libreria utilizza la SoftwareSerial, si possono cambiare i pin di RX e TX |
21 | | - * dall' intestazione "Sim800L.h", di default essi sono impostati come RX=10 RX=11 |
22 | | - * Assicurarsi di aver collegato il dispositivo al pin GND di Arduino. |
23 | | - * E' anche possibile cambiare il RESET_PIN. |
24 | | - * |
25 | | - * |
26 | | - * DEFAULT PINOUT: |
27 | | - * _____________________________ |
28 | | - * | ARDUINO UNO >>> Sim800L | |
29 | | - * ----------------------------- |
30 | | - * GND >>> GND |
31 | | - * RX 10 >>> TX |
32 | | - * TX 11 >>> RX |
33 | | - * RESET 2 >>> RST |
34 | | - * |
35 | | - * POWER SOURCE 4.2V >>> VCC |
36 | | - * |
37 | | - * |
38 | | - * SOFTWARE SERIAL NOTES: |
39 | | - * |
40 | | - * PINOUT |
41 | | - * The library has the following known limitations: |
42 | | - * 1. If using multiple software serial ports, only one can receive data at a time. |
43 | | - * 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). |
44 | | - * 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). |
45 | | - * 4. On Arduino or Genuino 101 the current maximum RX speed is 57600bps |
46 | | - * 5. On Arduino or Genuino 101 RX doesn't work on Pin 13 |
47 | | - * |
48 | | - * BAUD RATE |
49 | | - * Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200. |
50 | | - * |
51 | | - * |
52 | | - * Edited on: December 24, 2016 |
53 | | - * Editor: Vittorio Esposito |
54 | | - * |
55 | | - * Original version by: Cristian Steib |
56 | | - * |
57 | | - * |
58 | | -*/ |
59 | | - |
60 | | -#include <Sim800L.h> |
61 | | -#include <SoftwareSerial.h> |
62 | | - |
63 | | -#define RX 10 |
64 | | -#define TX 11 |
65 | | - |
66 | | -Sim800L GSM(RX, TX); |
67 | | - |
68 | | -/* |
69 | | - * In alternative: |
70 | | - * Sim800L GSM; // Use default pinout |
71 | | - * Sim800L GSM(RX, TX, RESET); |
72 | | - * Sim800L GSM(RX, TX, RESET, LED); |
73 | | - */ |
74 | | - |
75 | | -void setup(){ |
76 | | - Serial.begin(9600); |
77 | | - GSM.begin(4800); |
78 | | - |
79 | | - // Sleep |
80 | | - if (!GSM.setSleepMode(true)) Serial.println("ERROR"); |
81 | | - |
82 | | - if (GSM.setSleepMode(false)) Serial.println("Sleep mode is enabled"); |
83 | | - else Serial.println("Sleep mode is NOT enabled"); |
84 | | - |
85 | | - delay(5000); |
86 | | - |
87 | | - //Wake up |
88 | | - if (!GSM.setSleepMode(false)) Serial.println("ERROR"); |
89 | | - |
90 | | - if (GSM.getSleepMode()) Serial.println("Sleep mode is enabled"); |
91 | | - else Serial.println("Sleep mode is NOT enabled"); |
92 | | - |
93 | | - delay(5000); |
94 | | - |
95 | | -} |
96 | | - |
97 | | -void loop(){ |
98 | | - |
99 | | -} |
| 1 | +/* |
| 2 | + * This library was written by Vittorio Esposito |
| 3 | + * https://github.com/VittorioEsposito |
| 4 | + * |
| 5 | + * Designed to work with the GSM Sim800L. |
| 6 | + * |
| 7 | + * ENG |
| 8 | + * This library uses SoftwareSerial, you can define RX and TX pins |
| 9 | + * in the header "Sim800L.h", by default pins are RX=10 and TX=11. |
| 10 | + * Be sure that GND is connected to arduino too. |
| 11 | + * You can also change the RESET_PIN as you prefer. |
| 12 | + * |
| 13 | + * ESP |
| 14 | + * Esta libreria usa SoftwareSerial, se pueden cambiar los pines de RX y TX |
| 15 | + * en el archivo header, "Sim800L.h", por defecto los pines vienen configurado en |
| 16 | + * RX=10 TX=11. |
| 17 | + * Tambien se puede cambiar el RESET_PIN por otro que prefiera |
| 18 | + * |
| 19 | + * ITA |
| 20 | + * Questa libreria utilizza la SoftwareSerial, si possono cambiare i pin di RX e TX |
| 21 | + * dall' intestazione "Sim800L.h", di default essi sono impostati come RX=10 RX=11 |
| 22 | + * Assicurarsi di aver collegato il dispositivo al pin GND di Arduino. |
| 23 | + * E' anche possibile cambiare il RESET_PIN. |
| 24 | + * |
| 25 | + * |
| 26 | + * DEFAULT PINOUT: |
| 27 | + * _____________________________ |
| 28 | + * | ARDUINO UNO >>> Sim800L | |
| 29 | + * ----------------------------- |
| 30 | + * GND >>> GND |
| 31 | + * RX 10 >>> TX |
| 32 | + * TX 11 >>> RX |
| 33 | + * RESET 2 >>> RST |
| 34 | + * |
| 35 | + * POWER SOURCE 4.2V >>> VCC |
| 36 | + * |
| 37 | + * |
| 38 | + * SOFTWARE SERIAL NOTES: |
| 39 | + * |
| 40 | + * PINOUT |
| 41 | + * The library has the following known limitations: |
| 42 | + * 1. If using multiple software serial ports, only one can receive data at a time. |
| 43 | + * 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). |
| 44 | + * 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). |
| 45 | + * 4. On Arduino or Genuino 101 the current maximum RX speed is 57600bps |
| 46 | + * 5. On Arduino or Genuino 101 RX doesn't work on Pin 13 |
| 47 | + * |
| 48 | + * BAUD RATE |
| 49 | + * Supported baud rates are 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 31250, 38400, 57600, and 115200. |
| 50 | + * |
| 51 | + * |
| 52 | + * Edited on: December 24, 2016 |
| 53 | + * Editor: Vittorio Esposito |
| 54 | + * |
| 55 | + * Original version by: Cristian Steib |
| 56 | + * |
| 57 | + * |
| 58 | +*/ |
| 59 | + |
| 60 | +#include <Sim800L.h> |
| 61 | +#include <SoftwareSerial.h> |
| 62 | + |
| 63 | +#define RX 10 |
| 64 | +#define TX 11 |
| 65 | + |
| 66 | +Sim800L GSM(RX, TX); |
| 67 | + |
| 68 | +/* |
| 69 | + * In alternative: |
| 70 | + * Sim800L GSM; // Use default pinout |
| 71 | + * Sim800L GSM(RX, TX, RESET); |
| 72 | + * Sim800L GSM(RX, TX, RESET, LED); |
| 73 | + */ |
| 74 | + |
| 75 | +void setup(){ |
| 76 | + Serial.begin(9600); |
| 77 | + GSM.begin(4800); |
| 78 | + |
| 79 | + // Sleep |
| 80 | + if (!GSM.setSleepMode(true)) Serial.println("ERROR"); |
| 81 | + |
| 82 | + if (GSM.getSleepMode(false)) Serial.println("Sleep mode is enabled"); |
| 83 | + else Serial.println("Sleep mode is NOT enabled"); |
| 84 | + |
| 85 | + delay(5000); |
| 86 | + |
| 87 | + //Wake up |
| 88 | + if (!GSM.setSleepMode(false)) Serial.println("ERROR"); |
| 89 | + |
| 90 | + if (GSM.getSleepMode()) Serial.println("Sleep mode is enabled"); |
| 91 | + else Serial.println("Sleep mode is NOT enabled"); |
| 92 | + |
| 93 | + delay(5000); |
| 94 | + |
| 95 | +} |
| 96 | + |
| 97 | +void loop(){ |
| 98 | + |
| 99 | +} |
100 | 100 |
|
0 commit comments