You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. /**************************************************************
  2. *
  3. * To run this tool you need StreamDebugger library:
  4. * https://github.com/vshymanskyy/StreamDebugger
  5. * or from http://librarymanager/all#StreamDebugger
  6. *
  7. * TinyGSM Getting Started guide:
  8. * http://tiny.cc/tiny-gsm-readme
  9. *
  10. **************************************************************/
  11. // Set serial for debug console (to the Serial Monitor, speed 115200)
  12. #define SerialMonitor Serial
  13. // Set serial for AT commands (to the module)
  14. // Use Hardware Serial on Mega, Leonardo, Micro
  15. #define SerialAT Serial1
  16. // or Software Serial on Uno, Nano
  17. //#include <SoftwareSerial.h>
  18. //SoftwareSerial SerialAT(2, 3); // RX, TX
  19. #include <TinyGsmClient.h>
  20. #include <StreamDebugger.h>
  21. StreamDebugger DebugAT(SerialAT, SerialMonitor);
  22. TinyGsmClient gsm(DebugAT);
  23. void setup() {
  24. // Set console baud rate
  25. SerialMonitor.begin(115200);
  26. delay(10);
  27. // Set GSM module baud rate
  28. SerialAT.begin(115200);
  29. delay(3000);
  30. if (!gsm.begin()) {
  31. SerialMonitor.println(F("***********************************************************"));
  32. SerialMonitor.println(F(" Cannot initialize module!"));
  33. SerialMonitor.println(F(" Use File -> Examples -> TinyGSM -> tools -> AT_Debug"));
  34. SerialMonitor.println(F(" to find correct configuration"));
  35. SerialMonitor.println(F("***********************************************************"));
  36. return;
  37. }
  38. bool ret = gsm.factoryDefault();
  39. SerialMonitor.println(F("***********************************************************"));
  40. SerialMonitor.print (F(" Return settings to Factory Defaults: "));
  41. SerialMonitor.println((ret) ? "OK" : "FAIL");
  42. SerialMonitor.println(F("***********************************************************"));
  43. }
  44. void loop() {
  45. }