Fix tools
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
#define SerialAT Serial1
|
#define SerialAT Serial1
|
||||||
|
|
||||||
// or Software Serial on Uno, Nano
|
// or Software Serial on Uno, Nano
|
||||||
//#include <SoftwareSerialMonitor.h>
|
//#include <SoftwareSerial.h>
|
||||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||||
|
|
||||||
#include <TinyGsmClient.h>
|
#include <TinyGsmClient.h>
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#define SerialAT Serial1
|
#define SerialAT Serial1
|
||||||
|
|
||||||
// or Software Serial on Uno, Nano
|
// or Software Serial on Uno, Nano
|
||||||
//#include <SoftwareSerialMonitor.h>
|
//#include <SoftwareSerial.h>
|
||||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||||
|
|
||||||
#include <TinyGsmClient.h>
|
#include <TinyGsmClient.h>
|
||||||
|
@@ -19,31 +19,35 @@ char apn[] = "YourAPN";
|
|||||||
char user[] = "";
|
char user[] = "";
|
||||||
char pass[] = "";
|
char pass[] = "";
|
||||||
|
|
||||||
|
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
||||||
|
#define SerialMonitor Serial
|
||||||
|
|
||||||
|
// Set serial for AT commands (to the module)
|
||||||
// Use Hardware Serial on Mega, Leonardo, Micro
|
// Use Hardware Serial on Mega, Leonardo, Micro
|
||||||
#define GsmSerial Serial1
|
#define SerialAT Serial1
|
||||||
|
|
||||||
// or Software Serial on Uno, Nano
|
// or Software Serial on Uno, Nano
|
||||||
//#include <SoftwareSerial.h>
|
//#include <SoftwareSerial.h>
|
||||||
//SoftwareSerial GsmSerial(2, 3); // RX, TX
|
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||||
|
|
||||||
StreamDebugger DebugSerial(GsmSerial, Serial);
|
StreamDebugger DebugAT(SerialAT, SerialMonitor);
|
||||||
TinyGsmClient client(DebugSerial);
|
TinyGsmClient client(DebugAT);
|
||||||
|
|
||||||
char server[] = "cdn.rawgit.com";
|
char server[] = "cdn.rawgit.com";
|
||||||
char resource[] = "/vshymanskyy/tinygsm/master/extras/test_simple.txt";
|
char resource[] = "/vshymanskyy/tinygsm/master/extras/test_simple.txt";
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set console baud rate
|
// Set console baud rate
|
||||||
Serial.begin(115200);
|
SerialMonitor.begin(115200);
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
||||||
// Set GSM module baud rate
|
// Set GSM module baud rate
|
||||||
GsmSerial.begin(115200);
|
SerialAT.begin(115200);
|
||||||
delay(3000);
|
delay(3000);
|
||||||
|
|
||||||
// Restart takes quite some time
|
// Restart takes quite some time
|
||||||
// You can skip it in many cases
|
// You can skip it in many cases
|
||||||
Serial.println("Restarting modem...");
|
SerialMonitor.println("Restarting modem...");
|
||||||
client.restart();
|
client.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +76,7 @@ void loop() {
|
|||||||
while (client.connected() && millis() - timeout < 10000L) {
|
while (client.connected() && millis() - timeout < 10000L) {
|
||||||
while (client.available()) {
|
while (client.available()) {
|
||||||
char c = client.read();
|
char c = client.read();
|
||||||
//Serial.print(c);
|
//SerialMonitor.print(c);
|
||||||
bytesReceived += 1;
|
bytesReceived += 1;
|
||||||
timeout = millis();
|
timeout = millis();
|
||||||
}
|
}
|
||||||
@@ -82,10 +86,14 @@ void loop() {
|
|||||||
|
|
||||||
client.networkDisconnect();
|
client.networkDisconnect();
|
||||||
|
|
||||||
Serial.println();
|
SerialMonitor.println();
|
||||||
Serial.println("************************");
|
SerialMonitor.println("************************");
|
||||||
Serial.print (" Test: "); Serial.println((bytesReceived == 1000) ? "PASSED" : "FAIL");
|
SerialMonitor.print (" Received: ");
|
||||||
Serial.println("************************");
|
SerialMonitor.print(bytesReceived);
|
||||||
|
SerialMonitor.println("bytes");
|
||||||
|
SerialMonitor.print (" Test: ");
|
||||||
|
SerialMonitor.println((bytesReceived == 1000) ? "PASSED" : "FAIL");
|
||||||
|
SerialMonitor.println("************************");
|
||||||
|
|
||||||
// Do nothing forevermore
|
// Do nothing forevermore
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Reference in New Issue
Block a user