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.

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