printWifiStatus(); was not declared in this scope

Did check this code for hours without finding whats wrong.
What is going on?

#include<SoftwareSerial.h>
#include<WiFiEsp.h>

SoftwareSerial Serial1(6, 7);

char ssid[] = "dlink-10E4";
char pass[] = "Hongjuan50!";
int status = WL_IDLE_STATUS;

WiFiEspServer server(80);

void setup() {
Serial.begin(9600);
Serial1.begin(9600);
WiFi.init(&Serial1);

if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
while (true);
}
while (status != WL_CONNECTED) {
Serial.print("Attemting to connect to SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
}
Serial.println("You are connected to the network");
printWifiStatus();

server.begin();

}

void loop() {
WiFiEspClient client = server.available();

if (client) {
Serial.println("New client");
boolean currentLineIsBlank = true;

while (client.connected()) {
  if (client.available()) {
    char c = client.read();
    Serial.write(c);
    if (c == '\n' && currentLineIsBlank) {
      Serial.println("Sending responce");

      client.print(
        "HTTP/1.1 200 OK\r\n"
        "Content-Type: text/html\r\n"
        "Connection: close \r\n"
        "\r\n");
      client.print("<!DOCTYPE HTML>\r\n");
      client.print("<html>\r\n");
      client.print("<head>\r\n");
      client.print("<title>My Arduino</title>\r\n");
      client.print("<head>\r\n");
      client.print("<body>\r\n");
      client.print("<h1>Hello World!</h1>\r\n");
      client.print("<p>We are online!</p>\r\n");
      client.print("</body>\r\n");
      client.print("</html>\r\n");
      break;
    }
    if (c == '\n') {
      currentLineIsBlank = true;
      else if (c != '\r') {
        currentLineIsBlank = false;
      }
    }
  }
  delay(10);
  client.stop();
  Serial.println("Client disconnected");
}

}

void printWifiStatus() {
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

IPAddress ip = WiFi.localIP();
Serial.print("IP Adress: ");
Serial.println(ip);

}

Please post your code and all of the error messages you see, in code tags.

Where do you think the loop function ends?

The auto format tool would have found the problem in a fraction of a second.

Hi @ToreJohansson
A "}" is missing on line 76.
RV mineirin.

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