Function name declared void

Trying to use a function to update and LCD but keep the message noted in the topic.

Error messages are C:\Users\Karl\Documents\Arduino\WiFi1_Server_KI\WiFi1_Server_KI.ino:164:19: error: variable or field 'displayStatus' declared void
void displayStatus(%row, %msg){
^
C:\Users\Karl\Documents\Arduino\WiFi1_Server_KI\WiFi1_Server_KI.ino:164:20: error: expected primary-expression before '%' token
void displayStatus(%row, %msg){
^
C:\Users\Karl\Documents\Arduino\WiFi1_Server_KI\WiFi1_Server_KI.ino:164:26: error: expected primary-expression before '%' token
void displayStatus(%row, %msg){
^

exit status 1

Compilation error: variable or field 'displayStatus' declared void

Code is below

// WiFi1_Server_KI.ino  (this is server)
//Originally created by Tom Igoe 25 Nov 2012

#include "WiFiS3.h"
//#include "arduino_secrets.h" 

#define SECRET_SSID "XXXX"
#define SECRET_PASS "XXXXX"

///////please enter your sensitive data in the Secret tab/arduino_secrets.h
char ssid[] = SECRET_SSID;        // your network SSID (name)
char pass[] = SECRET_PASS;    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;                 // your network key index number (needed only for WEP)

int led =  LED_BUILTIN;
int status = WL_IDLE_STATUS;
WiFiServer server(80);

long randNumber;

//--------------------------------------
#include <Wire.h>  // For i2c
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
const int LCD_COLS = 20;
const int LCD_ROWS = 4;

float read0 = 0.00;
float read1 = 0.00;
float read2 = 0.00;
float read3 = 0.00;
 
String msg= "Starting";
int row = 0;


//---------------------------------------------------------------------------
void setup() {
  Serial.begin(115200);      // initialize serial communication
  pinMode(led, OUTPUT);      // set the LED pin mode
  msg.reserve(20);
  
// Serial.println("Starting Wifi connection");

  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println("Communication with WiFi module failed!");
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println("Please upgrade the firmware");
  }

  // attempt to connect to WiFi network:
  while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);               // print the network name (SSID);

    //displayStatus(0,ssid);

    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
    delay(10000);
  }
  server.begin();            // start the web server on port 80
  printWifiStatus();         // you're connected now, so print out the status


}

// -------------------------------------------------------------------------
void loop() {
  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {                    // if you get a client,
    Serial.println("new client");  // print a message out the serial port
    String currentLine = "";       // make a String to hold incoming data from the client
    while (client.connected()) {   // loop while the client's connected
      if (client.available()) {    // if there's bytes to read from the client,
              
        char c = client.read();    // read a byte, then
        Serial.write(c);           // print it out to the serial monitor
        if (c == '\n') {           // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a resp. code (e.g. HTTP/1.1 200 OK)
            // and content-type so the client knows what's coming, then blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();

            // the content of the HTTP response follows the header:
           // client.print("<p style=\"font-size:7vw;\">Click <a href=\"/H\">here</a> turn the LED on<br></p>");
           // client.print("<p style=\"font-size:7vw;\">Click <a href=\"/L\">here</a> turn the LED off<br></p>");

          // response start --------------  

           //client.println();
 
           randNumber = random(10, 30); 
            
            client.println(randNumber);


          // response end -------------------

            // The HTTP response ends with another blank line:
            client.println();
            // break out of the while loop:
            break;
          } else {    // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything but carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }

        // For html web page click ----------
        // Check to see if the client request was "GET /H" or "GET /L":
        if (currentLine.endsWith("GET /H")) {
          digitalWrite(LED_BUILTIN, HIGH);               // GET /H turns the LED on
        }
        if (currentLine.endsWith("GET /L")) {
          digitalWrite(LED_BUILTIN, LOW);                // GET /L turns the LED off
        }
       // End for html web page click -------------

      }
      
    }
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}
//-----------------------------------------------------------------
void printWifiStatus() {
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

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

  //displayStatus(1, ip);


  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}

void displayStatus(%row, %msg){
//  lcd.begin(LCD_COLS,LCD_ROWS);
//  lcd.backlight();
//  lcd.setCursor(0, row);
//  lcd.print(msg);
}

`

void displayStatus(int row, String msg){

What do you think the procent signs mean in that line?

2 Likes

Often one can suss out these messages by entering the text into a search engine.

"variable or field 'displayStatus' declared void" yields:

Thanks. That worked.