Hi there,
I use the WiFiEsp library ( #include "WiFiEsp.h" ). Works well enough. But if I try to pass one of its classes between the parentheses of a function, the compiler throws an error.
void a_function_that_displays_the_complete_site()
{
WiFiEspClient client = server.available();
// this works...
...
display_a_part_of_the_site(WiFiEspClient client);
// gives an error
...
}
Dear Bob, the complete sketch comprises six ino-files with 2500 lines. If you really think that is necessary, I will gladly do so. However, I hoped that somebody might have an opinion on the passing of classes as parameters.
The compiler is expecting an expression, its seeing a type name. You appear to be trying to pass a declaration as a value, which makes no sense. To the compiler "primary-expression" is the non-terminal in the grammar expected in this context, this is not that rare an error.
You can only pass an instance of WiFiEspClient to a function, not the type itself.
If any of those 30 years of programming was in C or C++, then you probably have been exposed to the standard technique of breaking large projects in to .h / .cpp / .c files. That provides a lot more control and modularity than the "Arduino Way" of using multiple .ino files. When you do that, the IDE simply mashes all the .ino files into one big compilation unit and hands it to the compiler. Really not modular at all. See my Post #5 here.