Hmmmmmmm...... (Hrngh!!!!!!!!!!)
Let's talk this through.
I'm referencing Tom's Making Things Talk AQI Web Client sketch for the Arduino Nano IoT33 to connect to a weather API through an HTTP GET request. Looks, sounds, and seems pretty simple, right?
I started with the Accuweather API and set up an API key and all that jazz. When I perform a curl GET request on terminal, and when I look it up locally, I get the data I'm looking for! Sweet!
But... when I drop all the information into the Arduino sketch, the Arduino doesn't connect to the API.
What does that mean?
At first, I was unable to parse the values I was looking for, so I went debugging...
Right now, there is a
if (https.connected()) {
Serial.println("connected.");
if (https.available()) {
Serial.println("available.");
} else{
Serial.println("failed!");
}
} else{
Serial.println("not available");
}
} else{
Serial.println("not connected");
}
Is it the Arduino? Maybe the WiFi is broken. I uploaded the sketch to another Arduino (same model) and got the same results. Hrngh!
Is it the port? I'm using port 443 for HTTPS calls, and I tried 80 and 8080 for HTTP calls, and even tried them across protocols, just to see if it would work. NADA!
Did I write the code bad? I uploaded Tom's example sketch and used my own AirNow API key, and got the same result. No connection made!
Is it the API? I tried connecting to another weather API, one that a Google search query made me believe was reliable: OpenWeather Map. Curl and local requests work great, but no luck on the Arduino!
Is the Arduino registered on the network? Great question! I sincerely thought this could have fixed the issues... but still no luck.