wonho-maker / Adafruit_SH1106

Adafruit graphic library for SH1106 dirver lcds.
Other
158 stars 93 forks source link

How to use in subclass? #6

Open SkHCrusher opened 7 years ago

SkHCrusher commented 7 years ago

Hi,

i want to build up a small menu lib for the OLED. But i have problems to use your lib in the main .ino file and also in a subclass like a Menu.cpp/Menu.h.

i reduced the Code but it doesn't work and I hope you can help me:

test.ino

`// Vendor Libs

include

include

Adafruit_SH1106 display = Adafruit_SH1106(51, 52, 5, 4, 6);

include "Menu.h";

Menu menu = Menu(display);

void setup() { display.begin(SH1106_SWITCHCAPVCC); display.display(); }

void loop() { }`

Menu.h

`#include

class Menu { public: Menu(); void Setup(Adafruit_SH1106& ssd1306); };`

Menu.cpp

`#include "Arduino.h"

include "Menu.h";

Menu::Menu() { //display.clearDisplay(); //display.display(); }

void Menu::Setup(Adafruit_SH1106& ssd1306) { return; }`