Update factory reset
This commit is contained in:
@@ -9,30 +9,46 @@
|
|||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
#include <TinyGsmClient.h>
|
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
||||||
#include <StreamDebugger.h>
|
#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 <SoftwareSerialMonitor.h>
|
||||||
//SoftwareSerial GsmSerial(2, 3); // RX, TX
|
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||||
|
|
||||||
StreamDebugger DebugSerial(GsmSerial, Serial);
|
#include <TinyGsmClient.h>
|
||||||
TinyGsmClient gsm(DebugSerial);
|
#include <StreamDebugger.h>
|
||||||
|
StreamDebugger DebugAT(SerialAT, SerialMonitor);
|
||||||
|
TinyGsmClient gsm(DebugAT);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
// Return to factory configuration
|
if (!gsm.begin()) {
|
||||||
gsm.factoryDefault();
|
SerialMonitor.println(F("***********************************************************"));
|
||||||
|
SerialMonitor.println(F(" Cannot initialize module!"));
|
||||||
|
SerialMonitor.println(F(" Use File -> Examples -> TinyGSM -> tools -> AT_Debug"));
|
||||||
|
SerialMonitor.println(F(" to find correct configuration"));
|
||||||
|
SerialMonitor.println(F("***********************************************************"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ret = gsm.factoryDefault();
|
||||||
|
|
||||||
|
SerialMonitor.println(F("***********************************************************"));
|
||||||
|
SerialMonitor.print (F(" Return settings to Factory Defaults: "));
|
||||||
|
SerialMonitor.println((ret) ? "OK" : "FAIL");
|
||||||
|
SerialMonitor.println(F("***********************************************************"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
Reference in New Issue
Block a user