Skip to content

Commit 98f9b85

Browse files
committed
Update GSM example sketch.
1 parent 6169a05 commit 98f9b85

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples/Connections/GSM/GSM.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Steps:
1414
//#define CAYENNE_DEBUG // Uncomment to show debug messages
1515
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
1616

17-
// Select your modem:
17+
// Uncomment your modem type:
1818
#define TINY_GSM_MODEM_SIM800
1919
// #define TINY_GSM_MODEM_SIM808
2020
// #define TINY_GSM_MODEM_SIM900
@@ -28,13 +28,15 @@ Steps:
2828

2929
#include <CayenneMQTTGSM.h>
3030

31-
// This sketch uses a software serial connection. You can replace this with a hardware serial if
32-
// your device supports it, e.g. Mega, Leonardo, etc.
31+
// This sketch uses a software serial connection.
3332
#include <SoftwareSerial.h>
3433
SoftwareSerial gsmSerial(2, 3); // RX, TX
34+
// If you are using a device that supports a hardware serial (Mega, Leonardo, etc.) and prefer to use
35+
// that you can comment out the above lines and uncomment the one below.
36+
//#define gsmSerial Serial1
3537

3638
// GSM connection info.
37-
char apn[] = "AccessPointName"; // Access point name. Leave empty if it is not needed.
39+
char apn[] = ""; // Access point name. Leave empty if it is not needed.
3840
char gprsLogin[] = ""; // GPRS username. Leave empty if it is not needed.
3941
char gprsPassword[] = ""; // GPRS password. Leave empty if it is not needed.
4042
char pin[] = ""; // SIM pin number. Leave empty if it is not needed.
@@ -46,6 +48,8 @@ char clientID[] = "CLIENT_ID";
4648

4749
void setup() {
4850
Serial.begin(9600);
51+
// Auto-detect the GSM serial baud rate. You can manually set it instead if you want to save a bit of space.
52+
TinyGsmAutoBaud(gsmSerial);
4953
Cayenne.begin(username, password, clientID, gsmSerial, apn, gprsLogin, gprsPassword, pin);
5054
}
5155

0 commit comments

Comments
 (0)