Arduino Uno wifi Rev2 and DHT sensor with Thingspeak

hello

guys I'm trying to send data from my Arduino Uno wifi Rev2 to my channel in Thingspeak but its don't work I need some help

this is the code

#include <ThingSpeak.h>
#include <WiFiNINA.h>
#include "dht.h"
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;

////////////////////////////////////////////////////////////////////////////////////////////////////////////
String apiKey = "XXXXXXXXXXXXXXX"; //API key from ThingSpeak channel
const char* ssid = "ZyXEL"; //SSID of your wifi
const char* password = "testi123"; //password of your wifi
int duration=5;//delay between each data measure and uploading
////////////////////////////////////////////////////////////////////////////////////////////////////////////

const char* server = "api.thingspeak.com";

WiFiClient client; //Start clinet

void setup()
{
Serial.begin(9600);

WiFi.begin(ssid, password);

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
}

void loop()
{
//read thermistor value
DHT.read11(dht_apin);
tempC = DHT.temperature;
tempF = DHT.humidity;
delay(200); //wait for 100 milliseconds

if (client.connect(server, 80)) {
String postStr = apiKey;
postStr += "field1=";
postStr += String(tempC);
postStr += "field2=";
postStr += String(tempF);
postStr += "\r\n\r\n";

//Uplad the postSting with temperature and Humidity information every
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);

Serial.print("Temperature: ");
Serial.print(tempC);
Serial.print(" degrees Celcius Humidity: ");
Serial.print(tempF);
Serial.println("% send to Thingspeak");
}
client.stop();

Serial.println("Waiting…");
// thingspeak needs minimum 15 sec delay between updates
delay(duration*1000);
}

Di que es lo que falla o dónde ves que falla, ¿se conecta a wifi?, ¿Se conecta a wifi pero no sube las medidas a thingspeak?, etc..

Solo viendo el código por encima veo que puede haber errores entre cómo se han declarado ciertas variables y cómo se han escrito al usarlas en el loop. Dale una vuelta y da más información. Puede ser problemas de hardware.

Un saludo.

Thanks for sharing such useful ideas here. You may also get more ideas from https://applesupportnumber.net/blog/solve-itunes-error-9/ page. This will be perfect if you are an iOS user.