library (class) creation question

Howdy. I’m new to Arduino and C++, and get the following error message:

In function ‘void loop()’:
error: request for member ‘ezCls’ in ‘ezLCD’, which is of non-class type ‘EzLCD () ()’

The Arduino code (sketch) is:

#include <ezLCD.h>

void setup(){Serial.begin(9600);}
int r = 76;
EzLCD ezLCD();

void loop(){
if (r==76) {
delay (2000);
Serial.print("""); // Light on
// EzLCD ezSetXY(120, 80, 0, 0);
}

// EzLCD ezCircle (0, 0, 0, r–); // Draw Circle

if (r<3) {
r=76 ;
delay(5000);
ezLCD.ezCls(0, 0, 255, 0); // Clear screen to white
// EzLCD ezSetColor(0, 0, 56, 0); // Green
}
}

The header file is ezLCD.h (in ezLCD directory) :
// ezLCD.h Driver for ezLCD001.
// (c) 2010 Earth Computer Technologies, Inc. dba EarthLCD.com
// Put in ezLCD directory in arduino. Example: …\arduino-0018\libraries\ezLCD\

#ifndef EzLCD_h
#define EzLCD_h

#include “WProgram.h”

class EzLCD
{
public:
EzLCD(int _x, int _y, int _color, int _radius);
void ezSetXY(int _x, int _y);
void ezCls(int _color);
void ezSetColor(int _color);
void ezCircle (int _radius);
};

#endif

The C++ file is ezLCD.cpp (in ezLCD directory) :

// ezLCD.cpp Driver for ezLCD001.
// (c) 2010 Earth Computer Technologies, Inc. dba EarthLCD.com
// Put in ezLCD directory in arduino. Example: …\arduino-0018\libraries\ezLCD\

#include “WProgram.h”
#include “EzLCD.h”

EzLCD::EzLCD(int _x, int _y, int _color, int _radius){
}

/*
void EzLCD::ezSetXY(int _x, int _y) {
if (_x >= 0 && _x <= 240 && _y >= 0 && _y <= 160 ){
Serial.print("%"); // SetXY
Serial.print(_x, BYTE); // SetXY X
Serial.print(_y, BYTE); // SetXY Y
}
}
*/

void EzLCD::ezCls(int _color) {
// ezSetColor(_color);
Serial.print("$"); //setcolor
Serial.print(“255”);//white
Serial.print("!"); // cls
}

/*
void EzLCD::ezSetColor(int _color){
Serial.print("$"); //setcolor
Serial.print(_color, BYTE);
}

void EzLCD::ezCircle (int _radius){
Serial.print(")"); // Cricle_R
Serial.print(_radius, BYTE);
}
*/

Thanks for your help.

EzLCD ezLCD();

What do you think that this statement is doing?

EzLCD is a class, which is also a type. So, this statement starts off trying to declare an instance of a class. This is followed by a function call, which is not what is expected here.

EzLCD myLCD = EzLCD();

would make more sense.

Before you go any further with this, please consider renaming some files. Windows stupidly doesn't care, but Linux does care, about case in file names. Making the file name match the class name will save you (and users of the class) untold amounts of grief in the future.

   ezLCD.ezCls(0, 0, 255, 0);  // Clear screen to white

ezLCD is not an instance of a class, so this call is incorrect.

If you use my example, the code would be:

   myLCD.ezCls(0, 0, 255, 0);  // Clear screen to white

since myLCD IS an instance of the EzLCD class.

OK, I did that and got the error message:

EzLCD myLCD = EzLCD(); //highlighted in yellow

and

error: no matching function for call to 'EzLCD::EzLCD()'C:\Users\intern\Desktop\arduino-0018\libraries\EzLCD/ezLCD.h:13: note: candidates are: EzLCD::EzLCD(int, int, int, int)

C:\Users\intern\Desktop\arduino-0018\libraries\EzLCD/ezLCD.h:11: note: EzLCD::EzLCD(const EzLCD&)

In function 'void loop()':

As far as " EzLCD ezLCD(); ", I copied " Morse morse(13); " from the example "Writing a Library for Ardwino".

Thanks

So the constructor (you defined it!) needs 4 arguments. Supply them.