11/*
22 GSMSSLlient
33
4- This sketch connects to a website (https://ifconfig.me )
4+ This sketch connects to a website (https://example.com )
55 using the Portenta CAT.M1/NB IoT GNSS Shield and TLS.
66
77 */
88
99#include < GSM.h>
10-
1110#include " arduino_secrets.h"
11+
12+ #if defined(ARDUINO_EDGE_CONTROL)
13+ #include " root_ca.h"
14+ #endif
15+
1216char pin[] = SECRET_PIN;
1317char apn[] = SECRET_APN;
1418char username[] = SECRET_USERNAME;
1519char pass[] = SECRET_PASSWORD;
1620
17- const char server[] = " ifconfig.me " ;
21+ const char server[] = " example.com " ;
1822const char * ip_address;
1923int port = 443 ;
2024GSMSSLClient client;
2125
2226void setup () {
27+
28+ #if defined(ARDUINO_EDGE_CONTROL)
29+ // Power ON MKR2
30+ pinMode (ON_MKR2, OUTPUT);
31+ digitalWrite (ON_MKR2, HIGH);
32+
33+ // Configure root certificate
34+ client.appendCustomCACert (root_ca);
35+ #endif
36+
2337 Serial.begin (115200 );
2438 while (!Serial) {}
39+
40+ // To enable AT Trace debug uncomment the following lines
41+ // GSM.trace(Serial);
42+ // GSM.setTraceLevel(4);
43+
2544 Serial.println (" Starting Carrier Network registration" );
2645 if (!GSM.begin (pin, apn, username, pass, CATM1, BAND_3 | BAND_20 | BAND_19)){
2746 Serial.println (" The board was not able to register to the network..." );
@@ -33,7 +52,7 @@ void setup() {
3352 if (client.connect (server, port)) {
3453 Serial.println (" connected to server" );
3554 // Make a HTTP request:
36- client.println (" GET /ip HTTP/1.1" );
55+ client.println (" GET / HTTP/1.1" );
3756 client.print (" Host: " );
3857 client.println (server);
3958 client.println (" Connection: close" );
0 commit comments