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.

75 lines
2.0 KiB

  1. /**************************************************************
  2. *
  3. * For this example, you need to install Blynk library:
  4. * https://github.com/blynkkk/blynk-library/releases/latest
  5. *
  6. * TinyGSM Getting Started guide:
  7. * http://tiny.cc/tiny-gsm-readme
  8. *
  9. **************************************************************
  10. *
  11. * Blynk is a platform with iOS and Android apps to control
  12. * Arduino, Raspberry Pi and the likes over the Internet.
  13. * You can easily build graphic interfaces for all your
  14. * projects by simply dragging and dropping widgets.
  15. *
  16. * Blynk supports many development boards with WiFi, Ethernet,
  17. * GSM, Bluetooth, BLE, USB/Serial connection methods.
  18. * See more in Blynk library examples and community forum.
  19. *
  20. * http://www.blynk.io/
  21. *
  22. * Change GPRS apm, user, pass, and Blynk auth token to run :)
  23. **************************************************************/
  24. #define BLYNK_PRINT Serial // Comment this out to disable prints and save space
  25. // Default heartbeat interval for GSM is 60
  26. // If you want override this value, uncomment and set this option:
  27. //#define BLYNK_HEARTBEAT 30
  28. #include <TinyGsmClient.h>
  29. #include <BlynkSimpleSIM800.h>
  30. // You should get Auth Token in the Blynk App.
  31. // Go to the Project Settings (nut icon).
  32. char auth[] = "YourAuthToken";
  33. // Your GPRS credentials
  34. // Leave empty, if missing user or pass
  35. char apn[] = "YourAPN";
  36. char user[] = "";
  37. char pass[] = "";
  38. // Hardware Serial on Mega, Leonardo, Micro
  39. #define GsmSerial Serial1
  40. // or Software Serial on Uno, Nano
  41. //#include <SoftwareSerial.h>
  42. //SoftwareSerial GsmSerial(2, 3); // RX, TX
  43. TinyGsmClient gsm(GsmSerial);
  44. void setup()
  45. {
  46. // Set console baud rate
  47. Serial.begin(115200);
  48. delay(10);
  49. // Set GSM module baud rate
  50. GsmSerial.begin(115200);
  51. delay(3000);
  52. // Restart takes quite some time
  53. // You can skip it in many cases
  54. Serial.println("Restarting modem...");
  55. gsm.restart();
  56. Blynk.begin(auth, gsm, apn, user, pass);
  57. }
  58. void loop()
  59. {
  60. Blynk.run();
  61. }