user60517: The code I used was from online and I tried using it to send data to firebase through web server. But the ouput I get from serial monitor was just "ATE0" which means there's something wrong. Hence, I can't proceed in solving this issue.
I tried several resources online to match my current problem.
I hope someone can help me
Thank you :)
#include <SoftwareSerial.h>;
SoftwareSerial Serial1(10, 11);
#include "DHT.h"
#define Terra "terra1"
#define DHTPIN 2    

#define DHTTYPE DHT22   

DHT dht(DHTPIN, DHTTYPE);

//const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2; eyagagana soy

int j=0;
int prev=0;
int pres=0;
String status="";
String buff(64);
String getStr(128);

void setup() {

  Serial.begin(9600);
  Serial1.begin(9600);
//  Serial.println(F("Humiture and Soil Moisture Sensors"));
  delay(2000);
  Serial1.setTimeout(5000);
  dht.begin();

   if (!connectWiFi()) {
    Serial.println("Can not connect to the WiFi.");
    while (true)
      ; // do nothing
  }
  Serial.println("OK, Connected to WiFi.");
  sendCommand("AT+CIPSTA?");
  sendCommand("AT+CIPDNS_CUR?");
  sendCommand("AT+CIPSTAMAC?");

}

void loop() {
 j=analogRead(A0);
  j=map(j,0,982,148,0);
  pres=j;
  if(j>100)
  j=100;
  else if(j<0)
  j=0;



  prev=j;
  delay(1000);

  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
//  if (isnan(h) || isnan(t) || isnan(f)) {
//    Serial.println(F("Failed to read from DHT sensor!"));
//    return;
//  }

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

//  Serial.print(F("Humidity: "));
//  Serial.print(h);
//  Serial.print(F("%  Temperature: "));
//  Serial.print(t);
//  Serial.print(F("°C "));
//  Serial.print(("Soil Moisture: "));
//  Serial.print(j);
// Serial.println("%");



// connect to server
  if (sendCommand("AT+CIPSTART=\"TCP\",\"https://terraduino.000webhostapp.com\",80")) {
    Serial.println("connected to Cloud");
    // build HTTP request
    getStr = "GET /upload.php?terra=";
    getStr += Terra;
    getStr += "&j=";
    getStr += j;
    getStr += "&t=";
    getStr += t;
    getStr += "&h=";
    getStr += h;
    getStr += " HTTP/1.1\r\n";
    //WEBSERVER
    getStr += "Host: https://terraduino.000webhostapp.com\r\n\r\n";
    // open send buffer
    buff = "AT+CIPSEND=";
    buff += getStr.length();
    if (sendCommand(buff.c_str()) && Serial1.find(">")) { // AT firmware is ready to accept data
      // send HTTP request
      Serial.println(getStr);
      Serial1.print(getStr);
      // print HTTP response
      if (Serial1.find("+IPD,")) { // response received
        int l = Serial1.parseInt();
        while (l > 0) {
          if (Serial1.available()) {
            Serial.write(Serial1.read());
          }
        }
        Serial.println("--------------");
      } else {
        Serial.println("no response");
      }
    } else {
      Serial.println("send error");
    }
    sendCommand("AT+CIPCLOSE");
  } else {
    Serial.println("Error connecting");
  }
}
bool connectWiFi() {
  if (!sendCommand("ATE0")) // echo off
    return false;
  if (!sendCommand("AT+CIPMUX=0")) // set single connection mode
    return false;
  if (!sendCommand("AT+CWMODE=1")) // set STA mode
    return false;

  return sendCommand("AT+CWJAP=\"I Pronounce you Man and Wifi\",\"-PX?*z3A_1x@.exe\"");
}
bool sendCommand(const char* cmd) {
  Serial.println(cmd);
  Serial1.println(cmd);
  while (true) {
    buff = Serial1.readStringUntil('\n');
    buff.trim();
    if (buff.length() > 0) {
      Serial.println(buff);
      if (buff == "OK" || buff == "SEND OK" || buff == "ALREADY CONNECTED")
        return true;
      if (buff == "ERROR" || buff == "FAIL" || buff == "SEND FAIL")
        return false;
    }
  }
}


user10285: I would say you are trapped in the sendCommand function. You print the cmd (cmd="ATE0") variable to the terminal and then send the command to the ESP over Serial1 = software serial. Serial1 is configured with a baud rate of 9600 (Serial1.begin(9600))  it depends on your ESP but that might be wrong. A common value is 115200 (Serial1.begin(115200)). But because that can vary from board to board, it could also be wrong. 
If I'm right and you configured a wrong baud rate, the command can not be understood by the ESP and even the newline after the command might be missing for it. 
So the ESP send nothing back and the 'buff.length()' equals to 0. Then the while(true) runs and runs and runs ... . 

60517: <p>The code I used was from online and I tried using it to send data to firebase through web server. But the ouput I get from serial monitor was just "ATE0" which means there's something wrong. Hence, I can't proceed in solving this issue.</p>

<p>I tried several resources online to match my current problem.</p>

<p>I hope someone can help me</p>

<p>Thank you :)</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;;
SoftwareSerial Serial1(10, 11);
#include "DHT.h"
#define Terra "terra1"
#define DHTPIN 2    

#define DHTTYPE DHT22   

DHT dht(DHTPIN, DHTTYPE);

//const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2; eyagagana soy

int j=0;
int prev=0;
int pres=0;
String status="";
String buff(64);
String getStr(128);

void setup() {

  Serial.begin(9600);
  Serial1.begin(9600);
//  Serial.println(F("Humiture and Soil Moisture Sensors"));
  delay(2000);
  Serial1.setTimeout(5000);
  dht.begin();

   if (!connectWiFi()) {
    Serial.println("Can not connect to the WiFi.");
    while (true)
      ; // do nothing
  }
  Serial.println("OK, Connected to WiFi.");
  sendCommand("AT+CIPSTA?");
  sendCommand("AT+CIPDNS_CUR?");
  sendCommand("AT+CIPSTAMAC?");

}

void loop() {
 j=analogRead(A0);
  j=map(j,0,982,148,0);
  pres=j;
  if(j&gt;100)
  j=100;
  else if(j&lt;0)
  j=0;



  prev=j;
  delay(1000);

  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
//  if (isnan(h) || isnan(t) || isnan(f)) {
//    Serial.println(F("Failed to read from DHT sensor!"));
//    return;
//  }

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

//  Serial.print(F("Humidity: "));
//  Serial.print(h);
//  Serial.print(F("%  Temperature: "));
//  Serial.print(t);
//  Serial.print(F("°C "));
//  Serial.print(("Soil Moisture: "));
//  Serial.print(j);
// Serial.println("%");



// connect to server
  if (sendCommand("AT+CIPSTART=\"TCP\",\"https://terraduino.000webhostapp.com\",80")) {
    Serial.println("connected to Cloud");
    // build HTTP request
    getStr = "GET /upload.php?terra=";
    getStr += Terra;
    getStr += "&amp;j=";
    getStr += j;
    getStr += "&amp;t=";
    getStr += t;
    getStr += "&amp;h=";
    getStr += h;
    getStr += " HTTP/1.1\r\n";
    //WEBSERVER
    getStr += "Host: https://terraduino.000webhostapp.com\r\n\r\n";
    // open send buffer
    buff = "AT+CIPSEND=";
    buff += getStr.length();
    if (sendCommand(buff.c_str()) &amp;&amp; Serial1.find("&gt;")) { // AT firmware is ready to accept data
      // send HTTP request
      Serial.println(getStr);
      Serial1.print(getStr);
      // print HTTP response
      if (Serial1.find("+IPD,")) { // response received
        int l = Serial1.parseInt();
        while (l &gt; 0) {
          if (Serial1.available()) {
            Serial.write(Serial1.read());
          }
        }
        Serial.println("--------------");
      } else {
        Serial.println("no response");
      }
    } else {
      Serial.println("send error");
    }
    sendCommand("AT+CIPCLOSE");
  } else {
    Serial.println("Error connecting");
  }
}
bool connectWiFi() {
  if (!sendCommand("ATE0")) // echo off
    return false;
  if (!sendCommand("AT+CIPMUX=0")) // set single connection mode
    return false;
  if (!sendCommand("AT+CWMODE=1")) // set STA mode
    return false;

  return sendCommand("AT+CWJAP=\"I Pronounce you Man and Wifi\",\"-PX?*z3A_1x@.exe\"");
}
bool sendCommand(const char* cmd) {
  Serial.println(cmd);
  Serial1.println(cmd);
  while (true) {
    buff = Serial1.readStringUntil('\n');
    buff.trim();
    if (buff.length() &gt; 0) {
      Serial.println(buff);
      if (buff == "OK" || buff == "SEND OK" || buff == "ALREADY CONNECTED")
        return true;
      if (buff == "ERROR" || buff == "FAIL" || buff == "SEND FAIL")
        return false;
    }
  }
}
</code></pre>
 10285: <p>I would say you are trapped in the <code>sendCommand</code> function. You print the <code>cmd</code> (cmd="ATE0") variable to the terminal and then send the command to the ESP over Serial1 = software serial. Serial1 is configured with a baud rate of 9600 (<code>Serial1.begin(9600)</code>)  it depends on your ESP but that might be wrong. A common value is 115200 (<code>Serial1.begin(115200)</code>). But because that can vary from board to board, it could also be wrong. </p>

<p>If I'm right and you configured a wrong baud rate, the command can not be understood by the ESP and even the newline after the command might be missing for it. </p>

<p>So the ESP send nothing back and the 'buff.length()' equals to 0. Then the <code>while(true)</code> runs and runs and runs ... . </p>
