Update example
This commit is contained in:
@@ -35,6 +35,8 @@ TinyGsmClient client(modem);
|
|||||||
const char server[] = "cdn.rawgit.com";
|
const char server[] = "cdn.rawgit.com";
|
||||||
const char resource[] = "/vshymanskyy/tinygsm/master/extras/logo.txt";
|
const char resource[] = "/vshymanskyy/tinygsm/master/extras/logo.txt";
|
||||||
|
|
||||||
|
int port = 80;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Set console baud rate
|
// Set console baud rate
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
@@ -46,7 +48,7 @@ void setup() {
|
|||||||
|
|
||||||
// Restart takes quite some time
|
// Restart takes quite some time
|
||||||
// To skip it, call init() instead of restart()
|
// To skip it, call init() instead of restart()
|
||||||
Serial.println("Initializing modem...");
|
Serial.println(F("Initializing modem..."));
|
||||||
modem.restart();
|
modem.restart();
|
||||||
|
|
||||||
// Unlock your SIM card with a PIN
|
// Unlock your SIM card with a PIN
|
||||||
@@ -54,7 +56,7 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print("Waiting for network...");
|
Serial.print(F("Waiting for network..."));
|
||||||
if (!modem.waitForNetwork()) {
|
if (!modem.waitForNetwork()) {
|
||||||
Serial.println(" fail");
|
Serial.println(" fail");
|
||||||
delay(10000);
|
delay(10000);
|
||||||
@@ -62,7 +64,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
Serial.println(" OK");
|
Serial.println(" OK");
|
||||||
|
|
||||||
Serial.print("Connecting to ");
|
Serial.print(F("Connecting to "));
|
||||||
Serial.print(apn);
|
Serial.print(apn);
|
||||||
if (!modem.gprsConnect(apn, user, pass)) {
|
if (!modem.gprsConnect(apn, user, pass)) {
|
||||||
Serial.println(" fail");
|
Serial.println(" fail");
|
||||||
@@ -71,9 +73,9 @@ void loop() {
|
|||||||
}
|
}
|
||||||
Serial.println(" OK");
|
Serial.println(" OK");
|
||||||
|
|
||||||
Serial.print("Connecting to ");
|
Serial.print(F("Connecting to "));
|
||||||
Serial.print(server);
|
Serial.print(server);
|
||||||
if (!client.connect(server, 80)) {
|
if (!client.connect(server, port)) {
|
||||||
Serial.println(" fail");
|
Serial.println(" fail");
|
||||||
delay(10000);
|
delay(10000);
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user