Skip to content

Commit

Permalink
Update Network example #178
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Nov 16, 2024
1 parent 3abbf5c commit c73b15e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions examples/Network/Network.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TinyGsm modem(debugger);
TinyGsm modem(SerialAT);
#endif

// It depends on the operator whether to set up an APN. If some operators do not set up an APN,
// It depends on the operator whether to set up an APN. If some operators do not set up an APN,
// they will be rejected when registering for the network. You need to ask the local operator for the specific APN.
// APNs from other operators are welcome to submit PRs for filling.
// #define NETWORK_APN "CHN-CT" //CHN-CT: China Telecom
Expand Down Expand Up @@ -162,7 +162,18 @@ void setup()
Serial.print("Network IP:"); Serial.println(ipAddress);



String resolved_ip_addr;
uint32_t rep_data_packet_size;
uint32_t tripTime;
uint8_t TTL;
for (int i = 0; i < 20; ++i) {
int res = modem.ping("www.baidu.com", resolved_ip_addr, rep_data_packet_size, tripTime, TTL);
if (res == 1) {
Serial.printf("Reply from %s: bytes=%u time=%ums TTL=%u\n", resolved_ip_addr, rep_data_packet_size, tripTime, TTL);
} else {
Serial.printf("Error code : %d\n", res);
}
}
}

void loop()
Expand Down

0 comments on commit c73b15e

Please sign in to comment.