So I'm making a library which is soposed to use another library of mine ("myTimer") to use timing. The library for time works great by itself, but I can't implement it properly in the other library (I'll call it "myOutput" for now), which I will use to controll an output.
I included both libraryes in the main sketch. The code only contains empty "setup()" and "loop()" and I'm just trying to compile the libraryes for now.
The simplified version of the header file of the "myOutput" library looks like this:
So I'm making a library which is soposed to use another library of mine ("myTimer") to use timing. The library for time works great by itself, but I can't implement it properly in the other library (I'll call it "myOutput" for now), which I will use to controll an output.
Not to be too picky, but if you decide to share the code, it's going to be a laughingstock with those names.
Perhaps you've noticed that it's not myAnalogRead(), myDigitalWrite(), etc.
You have two header files, two source files, and a sketch. You posted 2 of the 5, and expect us to know what's wrong. Well, I have a really good idea, but you need to post ALL FIVE FILES COMPLETELY (not "something like").
I have managed to get it working. I used initialization lists (which I don't quite understand yet).
This is the H file:
#ifndef dimmButton_h
#define dimmButton_h
#include <Arduino.h>
#include <myTimer.h>
class myOutput{
public:
myOutput(int intVar);
~myOutput();
private:
myTimer timer1; //here I just declared objects
myTimer timer2;
};
#endif
and the CPP file looks like this:
#include <myTimer.h>
myOutput::myOutput(int intVar) : timer1(), timer2(){ // and here I initialized them
//some code here
}
This is essnetialy how I did it. I know it's not such a big deal, but it took me a long time to figure it out. Sorry if the names seemed inappropriate to some. Hopefully someone will find this usefull.