I left the code unchanged, modifying only secrets.h.
I am using an ESP32-WROOM -32U
Connection to network succeeds, but ThingSpeak.writeFields fails every time, with HTTP error code 400.
The sketch I am really trying to use is loosely based on this example, accesses Time and Weather info with no problems, but ThingSpeak.writeFields fails with HTTP error code 301.
This is my first attempt to use ThingSpeak.
Is this example sketch still valid, or must I look elsewhere? Suggestions please.
6 Comments
Time DescendingA 400 error is because of bad inputs. If your only changes are in secrets.h, you might want to look at the sketch again. You definitely need to modify these before it will work. Make sure the values are correct.
unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;
The examples definitely still work.
Im a big fan of the 32 U layout. The one I use has an independant antenna connection and I get the longest range from those.
400 can mean authorization problem (though thats usually 401), so double check your channel id and api key.
the 301 error code is not an HTTP error, its an error from the library. It means there is a connectivity problem.
First I would check the connection strength (move closer to router), and also try a different network if possible.
It can be casued by an older version of the esp32 library that is the issue. (make sure to upgrade to the latest)
Sign in to participate