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.

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