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.

53 lines
1.1 KiB

  1. /**************************************************************
  2. *
  3. * DO NOT USE THIS - this is just a compilation test!
  4. *
  5. **************************************************************/
  6. #include <TinyGsmClient.h>
  7. TinyGsmClient client(Serial);
  8. char server[] = "somewhere";
  9. char resource[] = "something";
  10. void setup() {
  11. Serial.begin(115200);
  12. delay(3000);
  13. client.restart();
  14. }
  15. void loop() {
  16. if (!client.networkConnect("YourAPN", "", "")) {
  17. delay(10000);
  18. return;
  19. }
  20. if (!client.connect(server, 80)) {
  21. delay(10000);
  22. return;
  23. }
  24. // Make a HTTP GET request:
  25. client.print(String("GET ") + resource + " HTTP/1.0\r\n");
  26. client.print(String("Host: ") + server + "\r\n");
  27. client.print("Connection: close\r\n\r\n");
  28. unsigned long timeout = millis();
  29. while (client.connected() && millis() - timeout < 10000L) {
  30. // Print available data
  31. while (client.available()) {
  32. char c = client.read();
  33. timeout = millis();
  34. }
  35. }
  36. client.stop();
  37. client.networkDisconnect();
  38. // Do nothing forevermore
  39. while (true) {
  40. delay(1000);
  41. }
  42. }