From f7253e41ecb25dcd0fa0d9a3e6bedf2fc3dd6e75 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Tue, 1 May 2018 12:01:21 +0300 Subject: [PATCH] Updaate diagnostics --- tools/Diagnostics/Diagnostics.ino | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tools/Diagnostics/Diagnostics.ino b/tools/Diagnostics/Diagnostics.ino index 25515bb..7735301 100644 --- a/tools/Diagnostics/Diagnostics.ino +++ b/tools/Diagnostics/Diagnostics.ino @@ -13,6 +13,7 @@ #define TINY_GSM_MODEM_SIM800 // #define TINY_GSM_MODEM_SIM808 // #define TINY_GSM_MODEM_SIM900 +// #define TINY_GSM_MODEM_UBLOX // #define TINY_GSM_MODEM_A6 // #define TINY_GSM_MODEM_A7 // #define TINY_GSM_MODEM_M590 @@ -22,6 +23,9 @@ // Increase the buffer #define TINY_GSM_RX_BUFFER 512 +// Define the serial console for debug prints, if needed +//#define TINY_GSM_DEBUG Serial + #include // Your GPRS credentials @@ -45,11 +49,15 @@ const char pass[] = ""; #include StreamDebugger debugger(SerialAT, SerialMon); TinyGsm modem(debugger); -TinyGsmClient client(modem); const char server[] = "vsh.pp.ua"; const char resource[] = "/TinyGSM/logo.txt"; + const int port = 80; +TinyGsmClient client(myModem); + +//const int port = 443; +//TinyGsmClientSecure client(myModem); void setup() { // Set console baud rate @@ -75,6 +83,7 @@ void loop() { SerialMon.println(F(" Try useing File -> Examples -> TinyGSM -> tools -> AT_Debug to find correct configuration")); SerialMon.println(F("************************")); delay(10000); + return; } SerialMon.println(F(" [OK]")); @@ -112,6 +121,10 @@ void loop() { } SerialMon.println(F(" [OK]")); + IPAddress local = myModem.localIP(); + SerialMon.print("Local IP: "); + SerialMon.println(local); + SerialMon.print(F("Connecting to ")); SerialMon.print(server); if (!client.connect(server, port)) { @@ -126,6 +139,13 @@ void loop() { client.print(String("Host: ") + server + "\r\n"); client.print("Connection: close\r\n\r\n"); + // Wait for data to arrive + while (client.connected() && !client.available()) { + delay(100); + SerialMon.print('.'); + }; + SerialMon.println(); + // Skip all headers client.find("\r\n\r\n");