LiquidCrystal *lcd;
Menu menu1(lcd);
Having it like this in my sketch, I'm able to upload it. But obviously the arduino doesn't know the pin connections. Where should I define these?
I've tried things like Menu menu1(lcd(4, 5, 6, 7, 8, 12)); but with no luck...
testbestand_leds11.ino:17: error: 'lcd' cannot be used as a function Is the error I get.
Using the "Glyphduino" library; I managed to find my mistakes.
It should be as following:
Constructor:
Menu::Menu(LiquidCrystal *lcd){
this->lcd = lcd;
this->lcd->begin(16, 2);
this->lcd->clear();
}
Header:
class Menu
{
private:
LiquidCrystal *lcd;
public:
Menu(LiquidCrystal *lcd);
};
Sketch:
LiquidCrystal lcd(4, 5, 6, 7, 8, 12);
Menu* menu1 = new Menu(&lcd);
void setup() {
menu1->printMenu();
}
Thank you Oliver for helping me out!