Hi everyone.
I'm trying to send the ADC value from a potentiometer to the ThingSpeak channel and I'm dealing with the problem that I send data to ThingSpeak and I just receive zero value in the channel even if I turn the potentiometer knob. If I run the program without the ThingSpeak configuration everything work well.
Could you help me, please?
I leave the source code below.
Thank you.
/*THINGSPEAK CONFIGURATION*/
const char* ssid = "xxxxxx";
const char* password = "xxxxxx";
unsigned long channelID = xxxxxxx;
const char* WriteAPIKey = "xxxxxx";
Serial.println("ESP32 ADC");
WiFi.begin(ssid,password);
while(WiFi.status() != WL_CONNECTED)
Serial.println("\nWifi connected");
ThingSpeak.begin(Client);
ThingSpeak.writeFields(channelID,WriteAPIKey);
Serial.println("Send data.");
Serial.println("---------------\n");
int potVal = analogRead(ANALOGPIN);
Serial.println("Read failed");
potVal = analogRead(ANALOGPIN);
Serial.println("\nADC: ");
ThingSpeak.setField(1,potVal);