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.

47 lines
1.0 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
  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. #include <TinyGsmClient.h>
  12. #include <StreamDebugger.h>
  13. char apn[] = "YourAPN";
  14. char user[] = "";
  15. char pass[] = "";
  16. // Use Hardware Serial on Mega, Leonardo, Micro
  17. #define GsmSerial Serial1
  18. // or Software Serial on Uno, Nano
  19. //#include <SoftwareSerial.h>
  20. //SoftwareSerial GsmSerial(2, 3); // RX, TX
  21. StreamDebugger DebugSerial(GsmSerial, Serial);
  22. TinyGsmClient gsm(DebugSerial);
  23. void setup() {
  24. // Set console baud rate
  25. Serial.begin(115200);
  26. delay(10);
  27. // Set GSM module baud rate
  28. GsmSerial.begin(115200);
  29. delay(3000);
  30. gsm.networkConnect(apn, user, pass);
  31. // Access AT commands from Serial
  32. DebugSerial.directAccess();
  33. }
  34. void loop() {
  35. }