-
Notifications
You must be signed in to change notification settings - Fork 726
/
FactoryReset.ino
84 lines (72 loc) · 2.39 KB
/
FactoryReset.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**************************************************************
*
* 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_SIM868
// #define TINY_GSM_MODEM_SIM900
// #define TINY_GSM_MODEM_SIM5360
// #define TINY_GSM_MODEM_UBLOX
// #define TINY_GSM_MODEM_SARAR4
// #define TINY_GSM_MODEM_M95
// #define TINY_GSM_MODEM_BG95
// #define TINY_GSM_MODEM_BG96
// #define TINY_GSM_MODEM_A6
// #define TINY_GSM_MODEM_A7
// #define TINY_GSM_MODEM_M590
// #define TINY_GSM_MODEM_MC60
// #define TINY_GSM_MODEM_MC60E
// #define TINY_GSM_MODEM_ESP8266
// #define TINY_GSM_MODEM_ESP32
// #define TINY_GSM_MODEM_XBEE
// #define TINY_GSM_MODEM_SEQUANS_MONARCH
#include <TinyGsmClient.h>
// 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
#ifndef __AVR_ATmega328P__
#define SerialAT Serial1
// or Software Serial on Uno, Nano
#else
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX
#endif
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger);
void setup() {
// Set console baud rate
SerialMon.begin(115200);
delay(10);
// Set GSM module baud rate
SerialAT.begin(9600);
delay(6000);
if (!modem.init()) {
SerialMon.println(
F("***********************************************************"));
SerialMon.println(F(" Cannot initialize modem!"));
SerialMon.println(
F(" Use File -> Examples -> TinyGSM -> tools -> AT_Debug"));
SerialMon.println(F(" to find correct configuration"));
SerialMon.println(
F("***********************************************************"));
return;
}
bool ret = modem.factoryDefault();
SerialMon.println(
F("***********************************************************"));
SerialMon.print(F(" Return settings to Factory Defaults: "));
SerialMon.println((ret) ? "OK" : "FAIL");
SerialMon.println(
F("***********************************************************"));
}
void loop() {}