With some help here i've created a library for a small serial oled display. I create an instance with code like this;
uOLED uoled(8,256000, &Serial1); // reset=pin8, baudrate=256k and serial port to use =Serial1
After that the functions in the library (draw line etc.) use SerialX.write statements where X is the serial port mentioned.
In addition to that i've made another library for drawing bar-graphs. An instance is made with a line like
This graph-library has to use the functions of the uoled instance.
[u]The question;[/u] How do i 'glue' those 2 libraries together so that the graph-library is a 'child' of the uOLED-library.
example of desired functionality;
uOLED uoled1(8,256000, &Serial1); // reset=pin8, baudrate=256k and serial port to use =Serial1 uOLED uoled2(8,256000, &Serial2); // reset=pin8, baudrate=256k and serial port to use =Serial2 // 2 displays on different serial ports create an instance of bargraph in instance uoled1 create another instance of bargraph in instance uoled1 create an instance of bargraph in instance uoled2 create another instance of bargraph in instance uoled2
graph-lib code http://arduino.pastebin.com/f659b045
uOLED-lib code http://arduino.pastebin.com/f2d926db2
I have googled with keywords c++, inheritance but i did not understand enough to solve this on my own.
Thanks in advance,