Program showing error

`#include <dummy.h>
#include <ThingSpeak.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClient.h>

// WiFi Settings
const char* ssid = "Your WiFi SSID";
const char* password = "Your WiFi Password";

// ThingSpeak Settings
unsigned long myChannelNumber1 = 123456;
const char* myReadAPIKey1 = "Your Read API Key for Channel 1";
unsigned long myChannelNumber2 = 123457;
const char* myReadAPIKey2 = "Your Read API Key for Channel 2";
unsigned long myChannelNumber3 = 123458;
const char* myReadAPIKey3 = "Your Read API Key for Channel 3";
unsigned long myChannelNumber4 = 123459;
const char* myReadAPIKey4 = "Your Read API Key for Channel 4";
unsigned long myChannelNumber5 = 123460;
const char* myWriteAPIKey5 = "Your Write API Key for Channel 5";

// Moisture Threshold Settings
int lowerThreshold1 = 500; // Lower threshold for Field 1
int lowerThreshold2 = 450; // Lower threshold for Field 2
int lowerThreshold3 = 400; // Lower threshold for Field 3
int lowerThreshold4 = 350; // Lower threshold for Field 4
int upperThreshold = 600; // Upper threshold for all fields

// Solenoid Valve Settings
int solenoidValve1 = 33; // Solenoid valve pin for Field 1
int solenoidValve2 = 22; // Solenoid valve pin for Field 2
int solenoidValve3 = 21; // Solenoid valve pin for Field 3
int solenoidValve4 = 37; // Solenoid valve pin for Field 4

// Pump Settings
int pumpPin = 39; // Pump pin

// Variables
int moisture1, moisture2, moisture3, moisture4;

void setup() {
Serial.begin(115200);
pinMode(solenoidValve1, OUTPUT);
pinMode(solenoidValve2, OUTPUT);
pinMode(solenoidValve3, OUTPUT);
pinMode(solenoidValve4, OUTPUT);
pinMode(pumpPin, OUTPUT);
digitalWrite(pumpPin, LOW);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..."
ThingSpeak.begin(WiFiclient);

void loop()
if (WiFi.status() == WL_CONNECTED) {
moisture1 = ThingSpeak.readLongField(myChannelNumber1, 1, myReadAPIKey1);
moisture2 = ThingSpeak.readLongField(myChannelNumber2, 1, myReadAPIKey2);
moisture3 = ThingSpeak.readLongField(myChannelNumber3, 1, myReadAPIKey3);
moisture4 = ThingSpeak.readLongField(myChannelNumber4, 1, myReadAPIKey4);
if (moisture1 < lowerThreshold1 && moisture1 < upperThreshold) {
digitalWrite(solenoidValve1, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture2 < lowerThreshold2 && moisture2 < upperThreshold) {
digitalWrite(solenoidValve2, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture3 < lowerThreshold3 && moisture3 < upperThreshold) {
digitalWrite(solenoidValve3, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture4 < lowerThreshold4 && moisture4 < upperThreshold) {
digitalWrite(solenoidValve4, HIGH);
digitalWrite(pumpPin, HIGH);
}
delay(10000); // Delay for 10 seconds
digitalWrite(solenoidValve1, LOW);
digitalWrite(solenoidValve2, LOW);
digitalWrite(solenoidValve3, LOW);
digitalWrite(solenoidValve4, LOW);
digitalWrite(pumpPin, LOW);
}
delay(30000); // Delay for 30 seconds before reading again {
} `#include <Arduino.h>
#include <HTTPClient.h>

#include <WiFi.h>

#include <WiFiClient.h>

#include <dummy.h>

#include <ThingSpeak.h>
WiFiClient client;

// WiFi Settings
const char* ssid = "Your WiFi SSID";
const char* password = "Your WiFi Password";

// ThingSpeak Settings
unsigned long myChannelNumber1 = 123456;
const char* myReadAPIKey1 = "Your Read API Key for Channel 1";
unsigned long myChannelNumber2 = 123457;
const char* myReadAPIKey2 = "Your Read API Key for Channel 2";
unsigned long myChannelNumber3 = 123458;
const char* myReadAPIKey3 = "Your Read API Key for Channel 3";
unsigned long myChannelNumber4 = 123459;
const char* myReadAPIKey4 = "Your Read API Key for Channel 4";
unsigned long myChannelNumber5 = 123460;
const char* myWriteAPIKey5 = "Your Write API Key for Channel 5";

// Moisture Threshold Settings
int lowerThreshold1 = 500; // Lower threshold for Field 1
int lowerThreshold2 = 450; // Lower threshold for Field 2
int lowerThreshold3 = 400; // Lower threshold for Field 3
int lowerThreshold4 = 350; // Lower threshold for Field 4
int upperThreshold = 600; // Upper threshold for all fields

// Solenoid Valve Settings
int solenoidValve1 = 33; // Solenoid valve pin for Field 1
int solenoidValve2 = 22; // Solenoid valve pin for Field 2
int solenoidValve3 = 21; // Solenoid valve pin for Field 3
int solenoidValve4 = 37; // Solenoid valve pin for Field 4

// Pump Settings
int pumpPin = 37; // Pump pin

// Variables
int moisture1, moisture2, moisture3, moisture4;

void setup() {
Serial.begin(115200);
pinMode(solenoidValve1, OUTPUT);
pinMode(solenoidValve2, OUTPUT);
pinMode(solenoidValve3, OUTPUT);
pinMode(solenoidValve4, OUTPUT);
pinMode(pumpPin, OUTPUT);
digitalWrite(pumpPin, LOW);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
WiFiClient client;
ThingSpeak.begin(WiFiclient);

void loop()
if (WiFi.status() == WL_CONNECTED) {
moisture1 = ThingSpeak.readLongField(myChannelNumber1, 1, myReadAPIKey1);
moisture2 = ThingSpeak.readLongField(myChannelNumber2, 1, myReadAPIKey2);
moisture3 = ThingSpeak.readLongField(myChannelNumber3, 1, myReadAPIKey3);
moisture4 = ThingSpeak.readLongField(myChannelNumber4, 1, myReadAPIKey4);
if (moisture1 < lowerThreshold1 && moisture1 < upperThreshold) {
digitalWrite(solenoidValve1, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture2 < lowerThreshold2 && moisture2 < upperThreshold) {
digitalWrite(solenoidValve2, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture3 < lowerThreshold3 && moisture3 < upperThreshold) {
digitalWrite(solenoidValve3, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture4 < lowerThreshold4 && moisture4 < upperThreshold) {
digitalWrite(solenoidValve4, HIGH);
digitalWrite(pumpPin, HIGH);
}
delay(10000); // Delay for 10 seconds
digitalWrite(solenoidValve1, LOW);
digitalWrite(solenoidValve2, LOW);
digitalWrite(solenoidValve3, LOW);
digitalWrite(solenoidValve4, LOW);
digitalWrite(pumpPin, LOW);
}
delay(30000); // Delay for 30 seconds before reading again {
}

Why does no one read the forum guidelines before posting.

Read the forum guidelines to see how to properly post code and some good information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please go back and fix your original post.

Program showing error

Are we to guess what the error might be? Please post the entire error message. Paraphrasing the error leaves out important information. Copy and paste it to a new post after you fix the code in your original post.

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

We all want to help you, but if you don't follow the guidelines, you'll upset other people and your chance of getting help can decrease. I've already posted at least five times today how to insert code correctly, and it just makes you angry at times.
It should only be a hint to assess the consequences.

Oops.

Oops again.

There seem to be to sketches badly mashed together here

What are you doing there? That's right, if the first code is correct:

#include <dummy.h>
#include <ThingSpeak.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClient.h>

// WiFi Settings
const char* ssid = "Your WiFi SSID";
const char* password = "Your WiFi Password";

// ThingSpeak Settings
unsigned long myChannelNumber1 = 123456;
const char* myReadAPIKey1 = "Your Read API Key for Channel 1";
unsigned long myChannelNumber2 = 123457;
const char* myReadAPIKey2 = "Your Read API Key for Channel 2";
unsigned long myChannelNumber3 = 123458;
const char* myReadAPIKey3 = "Your Read API Key for Channel 3";
unsigned long myChannelNumber4 = 123459;
const char* myReadAPIKey4 = "Your Read API Key for Channel 4";
unsigned long myChannelNumber5 = 123460;
const char* myWriteAPIKey5 = "Your Write API Key for Channel 5";

// Moisture Threshold Settings
int lowerThreshold1 = 500; // Lower threshold for Field 1
int lowerThreshold2 = 450; // Lower threshold for Field 2
int lowerThreshold3 = 400; // Lower threshold for Field 3
int lowerThreshold4 = 350; // Lower threshold for Field 4
int upperThreshold = 600; // Upper threshold for all fields

// Solenoid Valve Settings
int solenoidValve1 = 33; // Solenoid valve pin for Field 1
int solenoidValve2 = 22; // Solenoid valve pin for Field 2
int solenoidValve3 = 21; // Solenoid valve pin for Field 3
int solenoidValve4 = 37; // Solenoid valve pin for Field 4

// Pump Settings
int pumpPin = 39; // Pump pin

// Variables
int moisture1, moisture2, moisture3, moisture4;

void setup() {
Serial.begin(115200);
pinMode(solenoidValve1, OUTPUT);
pinMode(solenoidValve2, OUTPUT);
pinMode(solenoidValve3, OUTPUT);
pinMode(solenoidValve4, OUTPUT);
pinMode(pumpPin, OUTPUT);
digitalWrite(pumpPin, LOW);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..."
ThingSpeak.begin(WiFiclient);

void loop()
if (WiFi.status() == WL_CONNECTED) {
moisture1 = ThingSpeak.readLongField(myChannelNumber1, 1, myReadAPIKey1);
moisture2 = ThingSpeak.readLongField(myChannelNumber2, 1, myReadAPIKey2);
moisture3 = ThingSpeak.readLongField(myChannelNumber3, 1, myReadAPIKey3);
moisture4 = ThingSpeak.readLongField(myChannelNumber4, 1, myReadAPIKey4);
if (moisture1 < lowerThreshold1 && moisture1 < upperThreshold) {
digitalWrite(solenoidValve1, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture2 < lowerThreshold2 && moisture2 < upperThreshold) {
digitalWrite(solenoidValve2, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture3 < lowerThreshold3 && moisture3 < upperThreshold) {
digitalWrite(solenoidValve3, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture4 < lowerThreshold4 && moisture4 < upperThreshold) {
digitalWrite(solenoidValve4, HIGH);
digitalWrite(pumpPin, HIGH);
}
delay(10000); // Delay for 10 seconds
digitalWrite(solenoidValve1, LOW);
digitalWrite(solenoidValve2, LOW);
digitalWrite(solenoidValve3, LOW);
digitalWrite(solenoidValve4, LOW);
digitalWrite(pumpPin, LOW);
}
delay(30000); // Delay for 30 seconds before reading again {
} `#include <Arduino.h>
#include <HTTPClient.h>

#include <WiFi.h>

#include <WiFiClient.h>

#include <dummy.h>

#include <ThingSpeak.h>
WiFiClient client;

// WiFi Settings
const char* ssid = "Your WiFi SSID";
const char* password = "Your WiFi Password";

// ThingSpeak Settings
unsigned long myChannelNumber1 = 123456;
const char* myReadAPIKey1 = "Your Read API Key for Channel 1";
unsigned long myChannelNumber2 = 123457;
const char* myReadAPIKey2 = "Your Read API Key for Channel 2";
unsigned long myChannelNumber3 = 123458;
const char* myReadAPIKey3 = "Your Read API Key for Channel 3";
unsigned long myChannelNumber4 = 123459;
const char* myReadAPIKey4 = "Your Read API Key for Channel 4";
unsigned long myChannelNumber5 = 123460;
const char* myWriteAPIKey5 = "Your Write API Key for Channel 5";

// Moisture Threshold Settings
int lowerThreshold1 = 500; // Lower threshold for Field 1
int lowerThreshold2 = 450; // Lower threshold for Field 2
int lowerThreshold3 = 400; // Lower threshold for Field 3
int lowerThreshold4 = 350; // Lower threshold for Field 4
int upperThreshold = 600; // Upper threshold for all fields

// Solenoid Valve Settings
int solenoidValve1 = 33; // Solenoid valve pin for Field 1
int solenoidValve2 = 22; // Solenoid valve pin for Field 2
int solenoidValve3 = 21; // Solenoid valve pin for Field 3
int solenoidValve4 = 37; // Solenoid valve pin for Field 4

// Pump Settings
int pumpPin = 37; // Pump pin

// Variables
int moisture1, moisture2, moisture3, moisture4;

void setup() {
Serial.begin(115200);
pinMode(solenoidValve1, OUTPUT);
pinMode(solenoidValve2, OUTPUT);
pinMode(solenoidValve3, OUTPUT);
pinMode(solenoidValve4, OUTPUT);
pinMode(pumpPin, OUTPUT);
digitalWrite(pumpPin, LOW);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
WiFiClient client;
ThingSpeak.begin(WiFiclient);

void loop()
if (WiFi.status() == WL_CONNECTED) {
moisture1 = ThingSpeak.readLongField(myChannelNumber1, 1, myReadAPIKey1);
moisture2 = ThingSpeak.readLongField(myChannelNumber2, 1, myReadAPIKey2);
moisture3 = ThingSpeak.readLongField(myChannelNumber3, 1, myReadAPIKey3);
moisture4 = ThingSpeak.readLongField(myChannelNumber4, 1, myReadAPIKey4);
if (moisture1 < lowerThreshold1 && moisture1 < upperThreshold) {
digitalWrite(solenoidValve1, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture2 < lowerThreshold2 && moisture2 < upperThreshold) {
digitalWrite(solenoidValve2, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture3 < lowerThreshold3 && moisture3 < upperThreshold) {
digitalWrite(solenoidValve3, HIGH);
digitalWrite(pumpPin, HIGH);
}
if (moisture4 < lowerThreshold4 && moisture4 < upperThreshold) {
digitalWrite(solenoidValve4, HIGH);
digitalWrite(pumpPin, HIGH);
}
delay(10000); // Delay for 10 seconds
digitalWrite(solenoidValve1, LOW);
digitalWrite(solenoidValve2, LOW);
digitalWrite(solenoidValve3, LOW);
digitalWrite(solenoidValve4, LOW);
digitalWrite(pumpPin, LOW);
}
delay(30000); // Delay for 30 seconds before reading again {
}
#include <dummy.h>
#include <ThingSpeak.h>
#include <HTTPClient.h>
#include <WiFi.h>
#include <WiFiClient.h>


// WiFi Settings
const char* ssid = "Your WiFi SSID";
const char* password = "Your WiFi Password";

// ThingSpeak Settings
unsigned long myChannelNumber1 = 123456;
const char* myReadAPIKey1 = "Your Read API Key for Channel 1";
unsigned long myChannelNumber2 = 123457;
const char* myReadAPIKey2 = "Your Read API Key for Channel 2";
unsigned long myChannelNumber3 = 123458;
const char* myReadAPIKey3 = "Your Read API Key for Channel 3";
unsigned long myChannelNumber4 = 123459;
const char* myReadAPIKey4 = "Your Read API Key for Channel 4";
unsigned long myChannelNumber5 = 123460;
const char* myWriteAPIKey5 = "Your Write API Key for Channel 5";

// Moisture Threshold Settings
int lowerThreshold1 = 500;  // Lower threshold for Field 1
int lowerThreshold2 = 450;  // Lower threshold for Field 2
int lowerThreshold3 = 400;  // Lower threshold for Field 3
int lowerThreshold4 = 350;  // Lower threshold for Field 4
int upperThreshold = 600;   // Upper threshold for all fields

// Solenoid Valve Settings
int solenoidValve1 = 33;    // Solenoid valve pin for Field 1
int solenoidValve2 = 22;    // Solenoid valve pin for Field 2
int solenoidValve3 = 21;    // Solenoid valve pin for Field 3
int solenoidValve4 = 37;    // Solenoid valve pin for Field 4

// Pump Settings
int pumpPin = 39;           // Pump pin

// Variables
int moisture1, moisture2, moisture3, moisture4;

void setup() {
  Serial.begin(115200);
  pinMode(solenoidValve1, OUTPUT);
  pinMode(solenoidValve2, OUTPUT);
  pinMode(solenoidValve3, OUTPUT);
  pinMode(solenoidValve4, OUTPUT);
  pinMode(pumpPin, OUTPUT);
  digitalWrite(pumpPin, LOW);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi..."
  ThingSpeak.begin(WiFiclient);

void loop() 
  if (WiFi.status() == WL_CONNECTED) {
    moisture1 = ThingSpeak.readLongField(myChannelNumber1, 1, myReadAPIKey1);
    moisture2 = ThingSpeak.readLongField(myChannelNumber2, 1, myReadAPIKey2);
    moisture3 = ThingSpeak.readLongField(myChannelNumber3, 1, myReadAPIKey3);
    moisture4 = ThingSpeak.readLongField(myChannelNumber4, 1, myReadAPIKey4);
    if (moisture1 < lowerThreshold1 && moisture1 < upperThreshold) {
      digitalWrite(solenoidValve1, HIGH);
      digitalWrite(pumpPin, HIGH);
    }
    if (moisture2 < lowerThreshold2 && moisture2 < upperThreshold) {
      digitalWrite(solenoidValve2, HIGH);
      digitalWrite(pumpPin, HIGH);
    }
    if (moisture3 < lowerThreshold3 && moisture3 < upperThreshold) {
      digitalWrite(solenoidValve3, HIGH);
      digitalWrite(pumpPin, HIGH);
    }      
    if (moisture4 < lowerThreshold4 && moisture4 < upperThreshold) {
      digitalWrite(solenoidValve4, HIGH);
      digitalWrite(pumpPin, HIGH);
    }      
delay(10000); // Delay for 10 seconds
digitalWrite(solenoidValve1, LOW);
digitalWrite(solenoidValve2, LOW);
digitalWrite(solenoidValve3, LOW);
digitalWrite(solenoidValve4, LOW);
digitalWrite(pumpPin, LOW);
}
delay(30000); // Delay for 30 seconds before reading again {  
} 
output
Users\User\Desktop\uma\sketch_apr3a\sketch_apr3a.ino: In function 'void setup()':
C:\Users\User\Desktop\uma\sketch_apr3a\sketch_apr3a.ino:67:20: error: 'WiFiclient' was not declared in this scope
   ThingSpeak.begin(WiFiclient);
                    ^
C:\Users\User\Desktop\uma\sketch_apr3a\sketch_apr3a.ino:70:3: error: expected initializer before 'if'
   if (WiFi.status() == WL_CONNECTED) {
   ^
C:\Users\User\Desktop\uma\sketch_apr3a\sketch_apr3a.ino:99:1: error: expected '}' at end of input
 }  
 ^

exit status 1

Compilation error: 'WiFiclient' was not declared in this scope

Hint: Where does the setup function end?

Also oops.

You have to adapt the code above.

I have deleted your other cross-post @surjeetadile.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

OP joined one hour before posting. I PMd OP to format and < code > paste which was done right. Perhaps a communication barrier.

That seems to me to be an appropriate amount of time to have read the guidelines.

It took me two days, and I missed some (I think). Haha.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.