Function Does Not Execute

I am working with a fairly complex program that involves several functions.

All of the functions execute properly, except for one.

I have extracted the non-working code below.

This reduced program compiles and runs, but the function "datatoSheets();" either is never called or never executes. (I check on operation using the Serial Monitor, where I see XX and YY, but no ZZ.)

Can someone tell me where I am going astray?

//  Extract is:  FORUM_TEST
///  These are needed for LCD  and W;Fi operation: 
#include <Wire.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include "HTTPSRedirect.h"
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>     //Local WebServer used to serve the configuration portal
#include <WiFiManager.h>  
 WiFiManager wifiManager;

#include <EEPROM.h> 

// Global Variables:

int temperature = 43;// Starting point
String PL =  "Pay Load";

String XX = "Line XX";
String YY = "Line YY";
String ZZ = "Line ZZ";
void setup() {

  Serial.println("mcb 8 May 20"); // mcb 8 may 20
  Serial.println(" In Setup");

} // end of setup  -  
// Modified for TEST - NOT  for use!!
void loop() { 

Serial.println("LoopStart-mcb  State=  "); // mcb 8 may 20

Serial.println(XX); //

byte datatoSheets();  // The byte returned is the  errorcode


//  End of the program!

  }  //loopend

//======== function start ===============

// This is the function:
byte datatoSheets(String PL){

Serial.print(" Starting - data to sheets function ");

}  //  "function end"
// End of everything!

This declares a new function, it does not call the function you have written later.

byte datatoSheets(); // The byte returned is the errorcode

This is not a function call:

byte datatoSheets();  // The byte returned is the  errorcode

This is a function call:

  datatoSheets();  // The byte returned is the  errorcode

Also, you have defined datatoSheets() to return a byte but you don't return anything.

Also, please hit ctrl-t in the Arduino IDE. This will auto-indent your code and make it much more readable.

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