The code uses the LiquidTWI library, which relies on other libraries, such as LiquidCrystal, Wire, and LCD. I've used includes on all of them, but the compiler does not recognize some.
Do the libraries have to be in one folder or something?
I posted the GitHub link with the .h, .cpp and keywords files. Here are my includes:
and here is the chunk of code that I am concerned about:
M16::M16(byte butOne, byte butTwo, byte butThree, byte butFour)
{
pinMode(butOne, INPUT_PULLUP);
pinMode(butTwo, INPUT_PULLUP);
pinMode(butThree, INPUT_PULLUP);
pinMode(butFour, INPUT_PULLUP);
_but1 = butOne;
_but2 = butTwo;
_but3 = butThree;
_but4 = butFour;
LiquidTWI lcd(0); // THIS IS WHERE THE QUESTION IS
}
Where I do the LiquidTWI call, I create an instance from that class, then I use lcd.print, or lcd.clear. These are the errors that are being returned. They look like this during compilation: Documents/Arduino/libraries/M16/M16.cpp:31: error: 'lcd' was not declared in this scope
I guess I have to declare lcd somewhere else? The (0) after lcd is the 8-bit address.
If you define lcd as a local variable in the constructor M16 it is not available after that. It is created on the stack and then removed after the constructor (M16).
"I guess I have to declare lcd somewhere else?" yepp.
I've tried a few things, but don't think I got it right. I declared lcd in the .cpp file outside of the M16 constructor and tried it in the sketch before setup. I tried these together and separate and neither seems to solve it completely.
Is it right to declare it in the library, then change the lcd call to M16.lcdprint?
pekasus:
Do the libraries have to be in one folder or something?
As a general rule, your sketchbook directory can contain all of your customized and add-on libraries, under the 'libraries' sub-directory. When you first bring up the Arduino IDE, it apparently scans your default sketchbook directory for 'libraries'. If it finds it, all of the sub-directories within that are scanned. If you have something there that the IDE doesn't like, you'll get a notification box complaining about it. In my case I have customized versions of the SD library, the Ethernet library, and a few other things with appropriate names 'MyEthernet' and 'MySD'. Then you just include them like any library and it should work fine.
If that's not your problem, you can try spitting out 'verbose' compile information to see what's going on. Under 'preferences' check the box for 'show verbose output during compiling', then attempt to build your project. It may be obvious what's happening from that.