Skip to content

Commit 12cd4c8

Browse files
author
Luigi Gubello
committed
Fixing
1 parent 75b08f7 commit 12cd4c8

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

examples/utility/SelfProvisioning/SelfProvisioning.ino

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include "arduino_secrets.h"
1919
#include "ECCX08TLSConfig.h"
20-
#include <ArduinoBearSSL.h>
2120
#include <ArduinoECCX08.h>
2221
#include <Arduino_JSON.h>
2322
#include <ArduinoIoTCloud.h>
@@ -80,18 +79,15 @@ void setup() {
8079

8180
while ( status != WL_CONNECTED) {
8281
Serial.print("Attempting to connect to Network named: ");
83-
Serial.println(ssid); // print the network name (SSID);
82+
Serial.println(ssid);
8483

85-
// Connect to WPA/WPA2 network:
8684
status = WiFi.begin(ssid, pass);
87-
delay(5000);
85+
delay(10000);
8886
}
8987

90-
// print the SSID of the network you're attached to:
9188
Serial.print("SSID: ");
9289
Serial.println(WiFi.SSID());
9390

94-
// print your WiFi shield's IP address:
9591
IPAddress ip = WiFi.localIP();
9692
Serial.print("IP Address: ");
9793
Serial.println(ip);
@@ -325,7 +321,6 @@ void ArduinoToken(String client_id, String client_secret) {
325321
PostData += "&audience=https://api2.arduino.cc/iot";
326322

327323
if (client.connect(server, 443)) {
328-
//Serial.println("connected to server");
329324
client.println("POST /iot/v1/clients/token HTTP/1.1");
330325
client.println("Host: api2.arduino.cc");
331326
client.println("Connection: close");
@@ -354,7 +349,6 @@ void ArduinoToken(String client_id, String client_secret) {
354349
int intIndex = 0;
355350
while (client.available()) {
356351
tokenResponse[intIndex] = client.read();
357-
//Serial.write(tokenResponse[intIndex]);
358352
if (tokenResponse[intIndex] == -1) {
359353
break;
360354
}
@@ -379,7 +373,6 @@ void BoardUuid(String board_name, String board_type, String board_fqbn, String b
379373
PostData += "\"}";
380374

381375
if (client.connect(server, 443)) {
382-
//Serial.println("connected to server");
383376
client.println("PUT /iot/v2/devices HTTP/1.1");
384377
client.println("Host: api2.arduino.cc");
385378
client.println("Connection: close");
@@ -432,7 +425,6 @@ void ArduinoCertificate(String user_token, String DeviceUuid, String csr) {
432425
PostData += "\",\"enabled\":true}";
433426

434427
if (client.connect(server, 443)) {
435-
//Serial.println("connected to server");
436428
client.print("PUT ");
437429
client.print(url);
438430
client.println(" HTTP/1.1");
@@ -450,10 +442,7 @@ void ArduinoCertificate(String user_token, String DeviceUuid, String csr) {
450442
while (!client.available()) {
451443
;
452444
}
453-
// while (client.available()) {
454-
// char c = client.read();
455-
// Serial.write(c);
456-
// }
445+
457446
char endOfHeaders[] = "\r\n\r\n";
458447
if (!client.find(endOfHeaders)) {
459448
Serial.println("Invalid response");
@@ -490,4 +479,4 @@ void ArduinoCertificate(String user_token, String DeviceUuid, String csr) {
490479
if (myCert.hasOwnProperty("signature_asn1_y")) {
491480
signature += (const char*) myCert["signature_asn1_y"];
492481
}
493-
}
482+
}

0 commit comments

Comments
 (0)