mathworks / thingspeak-arduino

ThingSpeak Communication Library for Arduino, ESP8266 and ESP32
https://thingspeak.com
438 stars 231 forks source link

Problem updating channel. HTTP error code -301 #76

Closed clabnet closed 3 years ago

clabnet commented 3 years ago

Hi, using the current git commit 81795bc on a NODEMCU 12E

#ifdef THINGS
#include "ThingSpeak.h"
unsigned long THINGSPEAKCHANNEL = 99999;
const char * THINGSPEAKKEY = "xxxxxxxxxxxxxxx";
#endif

On setup :

ThingSpeak.begin(wifiClient); // Initialize ThingSpeak
  int x = ThingSpeak.writeField(THINGSPEAKCHANNEL, 1, 0, THINGSPEAKKEY);
    if (x == 200)
    {    Serial.println("Channel update successful.");     }
    else
    {   Serial.println("Problem updating channel. HTTP error code " + String(x));   }

I have this error :

Problem updating channel. HTTP error code -301

There is a verbose log ? Any help ? tks

v-c commented 3 years ago

The -301 is a default status when the channel could not be updated. More often than not, this is on account of connectivity issues. You should be able to see more verbose messages in your serial monitor if you edit ThingSpeak.h header and uncomment the lines

// #define PRINT_DEBUG_MESSAGES // #define PRINT_HTTP