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.

65 lines
1.9 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
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. // Select your modem:
  12. #define TINY_GSM_MODEM_SIM800
  13. // #define TINY_GSM_MODEM_SIM900
  14. // #define TINY_GSM_MODEM_A6
  15. // #define TINY_GSM_MODEM_A7
  16. // #define TINY_GSM_MODEM_M590
  17. // #define TINY_GSM_MODEM_ESP8266
  18. #include <TinyGsmClient.h>
  19. // Set serial for debug console (to the Serial Monitor, speed 115200)
  20. #define SerialMon Serial
  21. // Set serial for AT commands (to the module)
  22. // Use Hardware Serial on Mega, Leonardo, Micro
  23. #define SerialAT Serial1
  24. // or Software Serial on Uno, Nano
  25. //#include <SoftwareSerial.h>
  26. //SoftwareSerial SerialAT(2, 3); // RX, TX
  27. #include <StreamDebugger.h>
  28. StreamDebugger debugger(SerialAT, SerialMon);
  29. TinyGsm modem(debugger);
  30. void setup() {
  31. // Set console baud rate
  32. SerialMon.begin(115200);
  33. delay(10);
  34. // Set GSM module baud rate
  35. SerialAT.begin(115200);
  36. delay(3000);
  37. if (!modem.init()) {
  38. SerialMon.println(F("***********************************************************"));
  39. SerialMon.println(F(" Cannot initialize modem!"));
  40. SerialMon.println(F(" Use File -> Examples -> TinyGSM -> tools -> AT_Debug"));
  41. SerialMon.println(F(" to find correct configuration"));
  42. SerialMon.println(F("***********************************************************"));
  43. return;
  44. }
  45. bool ret = modem.factoryDefault();
  46. SerialMon.println(F("***********************************************************"));
  47. SerialMon.print (F(" Return settings to Factory Defaults: "));
  48. SerialMon.println((ret) ? "OK" : "FAIL");
  49. SerialMon.println(F("***********************************************************"));
  50. }
  51. void loop() {
  52. }