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.

70 lines
2.0 KiB

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