I'm new to the arduino board and have no experience in c++. I'm currently trying to learn how to write a custom library. However, I'm running into some problems when including libraries in my own custom library. I think I'm doing something wrong when calling the LiquidCrystal library. The main question is: How to I call my libraries properly?
What I want to archive:
I have a LCD screen and a I2C device. I want to write a custom library which includes the LiquidCrystal and Wire libraries. Also, these libraries have to be available for use in the main program.
lcd.print("I am main program");
customLib cpp file:
LiquidCrystal lcd(4, 5, 6, 7, 8, 9, 10);
lcd.print("I am customLib");
Note: all this code is stripped down to the bare minimum I needed to describe my problem
When I compile this, it gives the error 'lcd was not declared in this scope'. This makes sense, as I've declared lcd in customLib.cpp. However, when I declare lcd in the main program, it will give the same error. This also makes sense, as I've now declared lcd in the main program, and not in the customLib.cpp. This brings us to the main question, How to I call my libraries properly?
Using the wire library gives no problems. I think this is because it doesn't need to be declared (e.g. no 'Wire wire;') in the code.
Thanks for your time, and I hope you can help me in understanding the Arduino code.