Skip to main content
Arduino

Return to Revisions

2 of 4
deleted 2066 characters in body
dda
  • 1.6k
  • 1
  • 12
  • 17

Need help with parsing NWS JSON weather alerts causing reset on ESP8266

I'm trying to parse the JSON string from the National Weather Service Alerts and am encountering a problem where the code can't parse the value and the device auto-resets. I've used this code before on a different API to get the current weather conditions, and that works fine - I'm not sure what I'm doing wrong and would greatly appreciate any advice or help. Thanks!

Here is the error:

21:13:07.521 -> wdt reset
21:13:07.521 -> load 0x4010f000, len 3424, room 16 
21:13:07.521 -> tail 0
21:13:07.521 -> chksum 0x2e
21:13:07.521 -> load 0x3fff20b8, len 40, room 8 
21:13:07.521 -> tail 0
21:13:07.521 -> chksum 0x2b
21:13:07.521 -> csum 0x2b
21:13:07.521 -> v00045d00
21:13:07.521 -> ~ld
21:13:07.555 -> ����n�r��n|�l�l`b��|r�l�n��n�l`��r�l�l��

And here's my code:

#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
const char* ssid = "mySSID"; // SSID of local network
const char* password = "myPassword"; // Password on network
WiFiClient client;
char weatherServerName[] = "api.weather.gov";
String result;
//For testing change this zone to any zone from the NWS that's currently experiencing a weather alert
//Find an active alert area by going to https://api.weather.gov/alerts/active and looking for the code in the "affectedZones"
String zone = "LEZ144";
bool hasAlert = false;
void setup() {
 Serial.begin(115200);
 Serial.println("=====================================================================================================");
 Serial.println("Connecting");
 WiFi.begin(ssid, password);
 while (WiFi.status() != WL_CONNECTED) {
 delay(500);
 Serial.print(".");
 }
 Serial.println("Connected");
 delay(1000);
}

AltStyle によって変換されたページ (->オリジナル) /