Hey
I am reading a basic C++ book and trying to implement some OOP in my sketch.
Without sensors, I think I understand the concept. But whenever I want to address objects from sensors I get stuck. Where is my thinking error?
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin
class myDisplay{
public:
Adafruit_SSD1306 display;
myDisplay(int widht, int height){
display(widht, height, &Wire, OLED_RESET);
}
void setup(){
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
}
void TextOutput(){
display.clearDisplay();
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(WHITE);
display.setCursor(10, 0);
display.println(F("scroll"));
display.display(); // Show
// Scroll in various directions, pausing in-between:
display.startscrollright(0x00, 0x0F);
}
};
myDisplay mD(128,64);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
mD.setup();
mD.TextOutput();
}
void loop() {
}
I cant access the constructor of the Adafruit_SSD1306 Object. What do i miss?
Build fail:
error: no match for call to '(Adafruit_SSD1306) (int&, int&, TwoWire*, int)'
display(widht, height, &Wire, OLED_RESET);
^
thanks for your help