Merge back from original
This commit is contained in:
@@ -19,14 +19,14 @@ env:
|
||||
|
||||
# Arduino test
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_A6' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_BG96' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_BG96' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_ESP8266' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_M95' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_M590' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_MC60' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM800' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM900' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM808' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM7000' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_UBLOX' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_XBEE' --project-option='framework=arduino' --board=uno --board=leonardo --board=yun --board=megaatmega2560 --board=genuino101 --board=mkr1000USB --board=zero --board=teensy31 --board=bluepill_f103c8 --board=uno_pic32 --board=esp01 --board=nodemcuv2 --board=esp32dev --board=mayfly"
|
||||
|
||||
@@ -38,8 +38,8 @@ env:
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_M590' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_MC60' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM800' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM900' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM808' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_SIM7000' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_UBLOX' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
- PLATFORMIO_CI_SRC=tools/test_build PLATFORMIO_CI_ARGS="--project-option='build_flags=-D TINY_GSM_MODEM_XBEE' --project-option='framework=energia' --board=lplm4f120h5qr"
|
||||
|
||||
|
@@ -33,6 +33,7 @@
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM868
|
||||
// #define TINY_GSM_MODEM_SIM7000
|
||||
// #define TINY_GSM_MODEM_UBLOX
|
||||
// #define TINY_GSM_MODEM_M95
|
||||
// #define TINY_GSM_MODEM_BG96
|
||||
|
@@ -18,6 +18,7 @@
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM868
|
||||
// #define TINY_GSM_MODEM_SIM7000
|
||||
// #define TINY_GSM_MODEM_UBLOX
|
||||
// #define TINY_GSM_MODEM_M95
|
||||
// #define TINY_GSM_MODEM_BG96
|
||||
|
@@ -22,6 +22,7 @@
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM868
|
||||
// #define TINY_GSM_MODEM_SIM7000
|
||||
// #define TINY_GSM_MODEM_UBLOX
|
||||
// #define TINY_GSM_MODEM_M95
|
||||
// #define TINY_GSM_MODEM_BG96
|
||||
|
@@ -32,6 +32,7 @@
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM868
|
||||
// #define TINY_GSM_MODEM_SIM7000
|
||||
// #define TINY_GSM_MODEM_UBLOX
|
||||
// #define TINY_GSM_MODEM_M95
|
||||
// #define TINY_GSM_MODEM_BG96
|
||||
|
@@ -1,199 +0,0 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* TinyGSM Getting Started guide:
|
||||
* https://tiny.cc/tinygsm-readme
|
||||
*
|
||||
* NOTE:
|
||||
* Some of the functions may be unavailable for your modem.
|
||||
* Just comment them out.
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
// Select your modem:
|
||||
//#define TINY_GSM_MODEM_SIM800
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
#define TINY_GSM_MODEM_SIM7000
|
||||
// #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
|
||||
|
||||
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
||||
#define SerialMon Serial
|
||||
|
||||
// Set serial for AT commands (to the module)
|
||||
// Use Hardware Serial on Mega, Leonardo, Micro, ESP32
|
||||
#include "HardwareSerial.h"
|
||||
#define SerialAT Serial2
|
||||
|
||||
// or Software Serial on Uno, Nano
|
||||
//#include <SoftwareSerial.h>
|
||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||
|
||||
#define MODEM_PWRKEY 18
|
||||
//#define DUMP_AT_COMMANDS
|
||||
#define TINY_GSM_DEBUG SerialMon
|
||||
|
||||
// Set phone numbers, if you want to test SMS and Calls
|
||||
//#define SMS_TARGET "+4366066033403"
|
||||
//#define CALL_TARGET "+43xxxxxx"
|
||||
|
||||
// Your GPRS credentials
|
||||
// Leave empty, if missing user or pass
|
||||
const char apn[] = "drei.at";
|
||||
const char user[] = "";
|
||||
const char pass[] = "";
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
|
||||
#ifdef DUMP_AT_COMMANDS
|
||||
#include <StreamDebugger.h>
|
||||
StreamDebugger debugger(SerialAT, SerialMon);
|
||||
TinyGsm modem(debugger);
|
||||
#else
|
||||
TinyGsm modem(SerialAT);
|
||||
TinyGsmClient client(modem);
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
// Set pwr pin 18 (ESP32) --> shield's PWRKEY
|
||||
pinMode(MODEM_PWRKEY, OUTPUT);
|
||||
powerOn(); //function for powering on SIM7000
|
||||
|
||||
// Set console baud rate
|
||||
SerialMon.begin(115200);
|
||||
delay(1000);
|
||||
|
||||
SerialAT.begin(9600);
|
||||
delay(1000);
|
||||
// Set GSM module baud rate
|
||||
//TinyGsmAutoBaud(SerialAT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
// Restart takes quite some time
|
||||
// To skip it, call init() instead of restart()
|
||||
DBG("Initializing modem...");
|
||||
if (!modem.restart()) {
|
||||
delay(15000);
|
||||
return;
|
||||
}
|
||||
|
||||
//String modemInfo = modem.getModemInfo();
|
||||
//DBG("Modem:", modemInfo);
|
||||
|
||||
// Unlock your SIM card with a PIN
|
||||
//modem.simUnlock("1234");
|
||||
|
||||
|
||||
// Network modes for SIM7000 (2-Automatic),(13-GSM Only),(38-LTE Only),(51-GSM And LTE Only)
|
||||
String NetworkModes = modem.getNetworkModes();
|
||||
DBG("Network Modes:", NetworkModes);
|
||||
|
||||
String NetworkMode = modem.setNetworkMode(0);
|
||||
DBG("Changed Network Mode:", NetworkMode);
|
||||
|
||||
// Preferred LTE mode selection (1-Cat-M),(2-NB-IoT),(3-Cat-M And NB-IoT)
|
||||
String PreferredModes = modem.getPreferredModes();
|
||||
DBG("Preferred Modes:", PreferredModes);
|
||||
|
||||
String PreferredMode = modem.setPreferredMode(3);
|
||||
DBG("Changed Preferred Mode:", PreferredMode);
|
||||
|
||||
|
||||
/* DBG("Waiting for network...");
|
||||
if (!modem.waitForNetwork()) {
|
||||
delay(10000);
|
||||
return;
|
||||
}
|
||||
|
||||
if (modem.isNetworkConnected()) {
|
||||
DBG("Network connected");
|
||||
}*/
|
||||
|
||||
/*
|
||||
DBG("Connecting to", apn);
|
||||
if (!modem.gprsConnect(apn, user, pass)) {
|
||||
delay(10000);
|
||||
return;
|
||||
}
|
||||
|
||||
bool res = modem.isGprsConnected();
|
||||
DBG("GPRS status:", res ? "connected" : "not connected");
|
||||
|
||||
String ccid = modem.getSimCCID();
|
||||
DBG("CCID:", ccid);
|
||||
|
||||
String imei = modem.getIMEI();
|
||||
DBG("IMEI:", imei);
|
||||
|
||||
String cop = modem.getOperator();
|
||||
DBG("Operator:", cop);
|
||||
|
||||
IPAddress local = modem.localIP();
|
||||
DBG("Local IP:", local);
|
||||
|
||||
int csq = modem.getSignalQuality();
|
||||
DBG("Signal quality:", csq);
|
||||
|
||||
// This is NOT supported on M590
|
||||
int battLevel = modem.getBattPercent();
|
||||
DBG("Battery lavel:", battLevel);
|
||||
|
||||
// This is only supported on SIMxxx series
|
||||
float battVoltage = modem.getBattVoltage() / 1000.0F;
|
||||
DBG("Battery voltage:", battVoltage);
|
||||
|
||||
// This is only supported on SIMxxx series
|
||||
String gsmLoc = modem.getGsmLocation();
|
||||
DBG("GSM location:", gsmLoc);
|
||||
|
||||
// This is only supported on SIMxxx series
|
||||
String gsmTime = modem.getGSMDateTime(DATE_TIME);
|
||||
DBG("GSM Time:", gsmTime);
|
||||
String gsmDate = modem.getGSMDateTime(DATE_DATE);
|
||||
DBG("GSM Date:", gsmDate);
|
||||
|
||||
|
||||
modem.enableGPS();
|
||||
String gps_raw = modem.getGPSraw();
|
||||
modem.disableGPS();
|
||||
DBG("GPS raw data:", gps_raw);
|
||||
|
||||
|
||||
#if defined(SMS_TARGET)
|
||||
res = modem.sendSMS(SMS_TARGET, String("Hello from ") + imei);
|
||||
DBG("SMS:", res ? "OK" : "fail");
|
||||
|
||||
// This is only supported on SIMxxx series
|
||||
res = modem.sendSMS_UTF16(SMS_TARGET, u"Привіііт!", 9);
|
||||
DBG("UTF16 SMS:", res ? "OK" : "fail");
|
||||
#endif
|
||||
|
||||
modem.gprsDisconnect();
|
||||
if (!modem.isGprsConnected()) {
|
||||
DBG("GPRS disconnected");
|
||||
} else {
|
||||
DBG("GPRS disconnect: Failed.");
|
||||
}
|
||||
*/
|
||||
|
||||
// Try to power-off (modem may decide to restart automatically)
|
||||
// To turn off modem completely, please use Reset/Enable pins
|
||||
modem.poweroff();
|
||||
DBG("Poweroff.");
|
||||
|
||||
// Do nothing forevermore
|
||||
while (true) {
|
||||
modem.maintain();
|
||||
}
|
||||
}
|
||||
|
||||
void powerOn() {
|
||||
digitalWrite(MODEM_PWRKEY, LOW);
|
||||
delay(100);
|
||||
digitalWrite(MODEM_PWRKEY, HIGH);
|
||||
}
|
@@ -1,187 +0,0 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* To run this tool you need StreamDebugger library:
|
||||
* https://github.com/vshymanskyy/StreamDebugger
|
||||
* or from http://librarymanager/all#StreamDebugger
|
||||
*
|
||||
* TinyGSM Getting Started guide:
|
||||
* https://tiny.cc/tinygsm-readme
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
// Select your modem:
|
||||
//#define TINY_GSM_MODEM_SIM800
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
#define TINY_GSM_MODEM_SIM7000
|
||||
// #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
|
||||
// #define TINY_GSM_MODEM_ESP8266
|
||||
// #define TINY_GSM_MODEM_XBEE
|
||||
|
||||
// Increase the buffer
|
||||
#define TINY_GSM_RX_BUFFER 512
|
||||
|
||||
// Define the serial console for debug prints, if needed
|
||||
//#define TINY_GSM_DEBUG Serial
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
|
||||
// Your GPRS credentials
|
||||
// Leave empty, if missing user or pass
|
||||
const char apn[] = "drei.at";
|
||||
const char user[] = "";
|
||||
const char pass[] = "";
|
||||
|
||||
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
||||
#define SerialMon Serial
|
||||
|
||||
// Set serial for AT commands (to the module)
|
||||
// Use Hardware Serial on Mega, Leonardo, Micro, Esp32
|
||||
#include "HardwareSerial.h"
|
||||
#define SerialAT Serial2
|
||||
|
||||
// or Software Serial on Uno, Nano
|
||||
//#include <SoftwareSerial.h>
|
||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||
|
||||
#include <StreamDebugger.h>
|
||||
StreamDebugger debugger(SerialAT, SerialMon);
|
||||
TinyGsm modem(debugger);
|
||||
|
||||
const char server[] = "vsh.pp.ua";
|
||||
const char resource[] = "/TinyGSM/logo.txt";
|
||||
|
||||
const int port = 80;
|
||||
TinyGsmClient client(modem);
|
||||
|
||||
// For SSL:
|
||||
//const int port = 443;
|
||||
//TinyGsmClientSecure client(modem);
|
||||
|
||||
void setup() {
|
||||
// Set console baud rate
|
||||
Serial.println("Starting Serial");
|
||||
SerialMon.begin(115200);
|
||||
delay(10);
|
||||
|
||||
// Set GSM module baud rate
|
||||
SerialAT.begin(9600);
|
||||
delay(3000);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Restart takes quite some time
|
||||
// To skip it, call init() instead of restart()
|
||||
SerialMon.print("Initializing modem...");
|
||||
if (!modem.restart()) {
|
||||
SerialMon.println(F(" [fail]"));
|
||||
SerialMon.println(F("************************"));
|
||||
SerialMon.println(F(" Is your modem connected properly?"));
|
||||
SerialMon.println(F(" Is your serial speed (baud rate) correct?"));
|
||||
SerialMon.println(F(" Is your modem powered on?"));
|
||||
SerialMon.println(F(" Do you use a good, stable power source?"));
|
||||
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]"));
|
||||
|
||||
String modemInfo = modem.getModemInfo();
|
||||
SerialMon.print("Modem: ");
|
||||
SerialMon.println(modemInfo);
|
||||
|
||||
// Unlock your SIM card with a PIN
|
||||
//modem.simUnlock("1234");
|
||||
|
||||
SerialMon.print("Waiting for network...");
|
||||
if (!modem.waitForNetwork()) {
|
||||
SerialMon.println(F(" [fail]"));
|
||||
SerialMon.println(F("************************"));
|
||||
SerialMon.println(F(" Is your sim card locked?"));
|
||||
SerialMon.println(F(" Do you have a good signal?"));
|
||||
SerialMon.println(F(" Is antenna attached?"));
|
||||
SerialMon.println(F(" Does the SIM card work with your phone?"));
|
||||
SerialMon.println(F("************************"));
|
||||
delay(10000);
|
||||
return;
|
||||
}
|
||||
SerialMon.println(F(" [OK]"));
|
||||
|
||||
SerialMon.print("Connecting to ");
|
||||
SerialMon.print(apn);
|
||||
if (!modem.gprsConnect(apn, user, pass)) {
|
||||
SerialMon.println(F(" [fail]"));
|
||||
SerialMon.println(F("************************"));
|
||||
SerialMon.println(F(" Is GPRS enabled by network provider?"));
|
||||
SerialMon.println(F(" Try checking your card balance."));
|
||||
SerialMon.println(F("************************"));
|
||||
delay(10000);
|
||||
return;
|
||||
}
|
||||
SerialMon.println(F(" [OK]"));
|
||||
|
||||
IPAddress local = modem.localIP();
|
||||
SerialMon.print("Local IP: ");
|
||||
SerialMon.println(local);
|
||||
|
||||
SerialMon.print(F("Connecting to "));
|
||||
SerialMon.print(server);
|
||||
if (!client.connect(server, port)) {
|
||||
SerialMon.println(F(" [fail]"));
|
||||
delay(10000);
|
||||
return;
|
||||
}
|
||||
SerialMon.println(F(" [OK]"));
|
||||
|
||||
// Make a HTTP GET request:
|
||||
client.print(String("GET ") + resource + " HTTP/1.0\r\n");
|
||||
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");
|
||||
|
||||
// Read data
|
||||
unsigned long timeout = millis();
|
||||
unsigned long bytesReceived = 0;
|
||||
while (client.connected() && millis() - timeout < 10000L) {
|
||||
while (client.available()) {
|
||||
char c = client.read();
|
||||
//SerialMon.print(c);
|
||||
bytesReceived += 1;
|
||||
timeout = millis();
|
||||
}
|
||||
}
|
||||
|
||||
client.stop();
|
||||
SerialMon.println(F("Server disconnected"));
|
||||
|
||||
modem.gprsDisconnect();
|
||||
SerialMon.println(F("GPRS disconnected"));
|
||||
|
||||
SerialMon.println();
|
||||
SerialMon.println(F("************************"));
|
||||
SerialMon.print (F(" Received: "));
|
||||
SerialMon.print(bytesReceived);
|
||||
SerialMon.println(F(" bytes"));
|
||||
SerialMon.print (F(" Test: "));
|
||||
SerialMon.println((bytesReceived == 121) ? "PASSED" : "FAILED");
|
||||
SerialMon.println(F("************************"));
|
||||
|
||||
// Do nothing forevermore
|
||||
while (true) {
|
||||
delay(1000);
|
||||
}
|
||||
}
|
@@ -13,6 +13,7 @@
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM868
|
||||
// #define TINY_GSM_MODEM_SIM7000
|
||||
// #define TINY_GSM_MODEM_UBLOX
|
||||
// #define TINY_GSM_MODEM_M95
|
||||
// #define TINY_GSM_MODEM_BG96
|
||||
|
Binary file not shown.
@@ -5,15 +5,15 @@
|
||||
"keywords": "GSM, AT commands, AT, SIM800, SIM900, A6, A7, M590, ESP8266, SIM7000, SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868, SIM900A, SIM900D, SIM908, SIM968, M95, MC60, MC60E, BG96, ublox, Quectel, SIMCOM, AI Thinker, LTE, LTE-M",
|
||||
"authors":
|
||||
[
|
||||
{
|
||||
"name": "Volodymyr Shymanskyy",
|
||||
"url": "https://github.com/vshymanskyy"
|
||||
},
|
||||
{
|
||||
"name": "Sara Damiano",
|
||||
"email": "sdamiano@stroudcenter.org",
|
||||
"url": "https://envirodiy.org/",
|
||||
"maintainer": true
|
||||
},
|
||||
{
|
||||
"name": "Volodymyr Shymanskyy",
|
||||
"url": "https://github.com/vshymanskyy"
|
||||
}
|
||||
],
|
||||
"repository":
|
||||
|
@@ -462,7 +462,7 @@ public:
|
||||
if (res != 1)
|
||||
return false;
|
||||
|
||||
return localIP() != 0;
|
||||
return localIP() != IPAddress(0,0,0,0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -500,7 +500,7 @@ public:
|
||||
if (res != 1)
|
||||
return false;
|
||||
|
||||
return localIP() != 0;
|
||||
return localIP() != IPAddress(0,0,0,0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -528,7 +528,7 @@ public:
|
||||
if (res != 1)
|
||||
return false;
|
||||
|
||||
return localIP() != 0;
|
||||
return localIP() != IPAddress(0,0,0,0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -598,7 +598,7 @@ public:
|
||||
if (res != 1)
|
||||
return false;
|
||||
|
||||
return localIP() != 0;
|
||||
return localIP() != IPAddress(0,0,0,0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -46,7 +46,6 @@ enum XBeeType {
|
||||
XBEE_3G = 0xB02, // Digi XBee® Cellular 3G
|
||||
XBEE3_LTE1_ATT = 0xB06, // Digi XBee3™ Cellular LTE CAT 1
|
||||
XBEE3_LTEM_ATT = 0xB08, // Digi XBee3™ Cellular LTE-M
|
||||
XBEE3_LTENB = 3, // Digi XBee3™ Cellular NB-IoT -- HS unknown to SRGD
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +78,7 @@ public:
|
||||
|
||||
public:
|
||||
// NOTE: The XBee saves all paramter information in flash. When you turn it
|
||||
// on it immediately begins to re-connect to whatever was last connected to.
|
||||
// on it immediately prepares to re-connect to whatever was last connected to.
|
||||
// All the modemConnect() function does is tell it the paramters to put into
|
||||
// flash. The connection itself is not opened until you attempt to send data.
|
||||
// Because all settings are saved to flash, it is possible (or likely) that
|
||||
@@ -408,7 +407,6 @@ public:
|
||||
case XBEE_3G: return "Digi XBee® Cellular 3G";
|
||||
case XBEE3_LTE1_ATT: return "Digi XBee3™ Cellular LTE CAT 1";
|
||||
case XBEE3_LTEM_ATT: return "Digi XBee3™ Cellular LTE-M";
|
||||
case XBEE3_LTENB: return "Digi XBee3™ Cellular NB-IoT";
|
||||
default: return "Digi XBee®";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user