Merge branch 'original'

This commit is contained in:
Sara Damiano
2018-09-05 17:42:03 -04:00
19 changed files with 78 additions and 12 deletions

View File

@@ -13,6 +13,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
@@ -123,7 +125,8 @@ void loop() {
}
#endif
bool res;
bool res = modem.isGprsConnected();
DBG("GPRS status:", res ? "connected" : "not connected");
String ccid = modem.getSimCCID();
DBG("CCID:", ccid);

View File

@@ -32,6 +32,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590

View File

@@ -17,6 +17,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590

View File

@@ -18,6 +18,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590

View File

@@ -10,7 +10,8 @@
* TinyGSM Getting Started guide:
* http://tiny.cc/tiny-gsm-readme
*
* SSL/TLS is currently supported only with SIM8xx series
* SSL/TLS is currently supported only with: SIM8xx, uBlox
*
* For more HTTP API examples, see ArduinoHttpClient library
*
**************************************************************/
@@ -18,6 +19,7 @@
// Select your modem:
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_UBLOX
// Increase RX buffer if needed
//#define TINY_GSM_RX_BUFFER 512

View File

@@ -31,6 +31,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
@@ -119,7 +121,14 @@ void setup() {
boolean mqttConnect() {
SerialMon.print("Connecting to ");
SerialMon.print(broker);
if (!mqtt.connect("GsmClientTest")) {
// Connect to MQTT Broker
boolean status = mqtt.connect("GsmClientTest");
// Or, if you want to authenticate MQTT:
//boolean status = mqtt.connect("GsmClientName", "mqtt_user", "mqtt_pass");
if (status == false) {
SerialMon.println(" fail");
return false;
}
@@ -131,9 +140,8 @@ boolean mqttConnect() {
void loop() {
if (mqtt.connected()) {
mqtt.loop();
} else {
if (!mqtt.connected()) {
SerialMon.println("=== MQTT NOT CONNECTED ===");
// Reconnect every 10 seconds
unsigned long t = millis();
if (t - lastReconnectAttempt > 10000L) {
@@ -142,8 +150,11 @@ void loop() {
lastReconnectAttempt = 0;
}
}
delay(100);
return;
}
mqtt.loop();
}
void mqttCallback(char* topic, byte* payload, unsigned int len) {

View File

@@ -12,6 +12,8 @@
#define TINY_GSM_MODEM_SIM800
// #define TINY_GSM_MODEM_SIM808
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590