Re-aligned with vshymanskyy-master
This commit is contained in:
@@ -10,12 +10,13 @@
|
||||
|
||||
// Select your modem:
|
||||
#define TINY_GSM_MODEM_SIM800
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #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
|
||||
// #define TINY_GSM_MODEM_XBEE
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
|
||||
@@ -30,7 +31,9 @@
|
||||
//#include <SoftwareSerial.h>
|
||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||
|
||||
TinyGsm modem(SerialAT);
|
||||
#define TINY_GSM_DEBUG SerialMon
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
|
||||
// Module baud rate
|
||||
uint32_t rate = 0; // Set to 0 for Auto-Detect
|
||||
@@ -44,21 +47,7 @@ void setup() {
|
||||
void loop() {
|
||||
|
||||
if (!rate) {
|
||||
static uint32_t rates[] = { 115200, 9600, 57600, 19200, 38400, 74400, 74880, 230400, 460800, 2400, 4800, 14400, 28800 };
|
||||
|
||||
SerialMon.println("Autodetecting baud rate");
|
||||
for (unsigned i = 0; i < sizeof(rates)/sizeof(rates[0]); i++) {
|
||||
SerialMon.print(String("Trying baud rate ") + rates[i] + "... ");
|
||||
SerialAT.begin(rates[i]);
|
||||
delay(10);
|
||||
if (modem.autoBaud(1000)) {
|
||||
rate = rates[i];
|
||||
SerialMon.println(F("OK"));
|
||||
break;
|
||||
} else {
|
||||
SerialMon.println(F("fail"));
|
||||
}
|
||||
}
|
||||
rate = TinyGsmAutoBaud(SerialAT);
|
||||
}
|
||||
|
||||
if (!rate) {
|
||||
|
@@ -11,18 +11,18 @@
|
||||
|
||||
// Select your modem:
|
||||
#define TINY_GSM_MODEM_SIM800
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #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
|
||||
// #define TINY_GSM_MODEM_XBEE
|
||||
|
||||
// Increase buffer fo see less commands
|
||||
#define TINY_GSM_RX_BUFFER 256
|
||||
// Increase the buffer
|
||||
#define TINY_GSM_RX_BUFFER 512
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
#include <StreamDebugger.h>
|
||||
|
||||
// Your GPRS credentials
|
||||
// Leave empty, if missing user or pass
|
||||
@@ -42,12 +42,13 @@ const char pass[] = "";
|
||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||
|
||||
|
||||
#include <StreamDebugger.h>
|
||||
StreamDebugger debugger(SerialAT, SerialMon);
|
||||
TinyGsm modem(debugger);
|
||||
TinyGsmClient client(modem);
|
||||
|
||||
const char server[] = "cdn.rawgit.com";
|
||||
const char resource[] = "/vshymanskyy/tinygsm/master/extras/test_simple.txt";
|
||||
const char resource[] = "/vshymanskyy/tinygsm/master/extras/logo.txt";
|
||||
|
||||
void setup() {
|
||||
// Set console baud rate
|
||||
@@ -144,9 +145,9 @@ void loop() {
|
||||
SerialMon.println("************************");
|
||||
SerialMon.print (" Received: ");
|
||||
SerialMon.print(bytesReceived);
|
||||
SerialMon.println("bytes");
|
||||
SerialMon.println(" bytes");
|
||||
SerialMon.print (" Test: ");
|
||||
SerialMon.println((bytesReceived == 1000) ? "PASSED" : "FAIL");
|
||||
SerialMon.println((bytesReceived == 121) ? "PASSED" : "FAILED");
|
||||
SerialMon.println("************************");
|
||||
|
||||
// Do nothing forevermore
|
||||
|
@@ -11,15 +11,15 @@
|
||||
|
||||
// Select your modem:
|
||||
#define TINY_GSM_MODEM_SIM800
|
||||
// #define TINY_GSM_MODEM_SIM808
|
||||
// #define TINY_GSM_MODEM_SIM900
|
||||
// #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
|
||||
// #define TINY_GSM_MODEM_XBEE
|
||||
|
||||
#include <TinyGsmClient.h>
|
||||
#include <StreamDebugger.h>
|
||||
|
||||
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
||||
#define SerialMon Serial
|
||||
@@ -32,6 +32,7 @@
|
||||
//#include <SoftwareSerial.h>
|
||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||
|
||||
#include <StreamDebugger.h>
|
||||
StreamDebugger debugger(SerialAT, SerialMon);
|
||||
TinyGsm modem(debugger);
|
||||
|
||||
|
Reference in New Issue
Block a user