Hello everyone,
I could really use some help. I've got a simplified script that I can not get working :
File : Bug.ino
#include "Screen.h"
Screen screen;
void loop(){
screen.output();
Serial.print("Loop");
Serial.println();
}
void setup(){
Serial.begin(115200);
}
Screen.h
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
class Screen
{
private:
Adafruit_SSD1306 display;
unsigned long startTime = 0;
public :
Screen();
void init();
void output();
};
Screen.cpp
#include "Screen.h"
Screen::Screen() {
init();
}
void Screen::init() {
this->display = Adafruit_SSD1306(128, 64, &Wire, -1);
this->display.begin(SSD1306_SWITCHCAPVCC, 0x3D);
this->display.setTextSize(1);
this->display.setTextColor(SSD1306_WHITE);
}
void Screen::output(){
this->display.setCursor(1, 1);
this->display.print("TEST");
this->display.display();
}
As the subject says, this compiles fine, no warnings/errors but it kills my serial output and doesn't display anything on the screen.
Below is a similar script which is very similar single page script which works fine for me. Makes me think it is a dependency issue or something about how I split into into multiple pages but I tried all different configurations of including files/dependencies above. Does anyone have any suggestions on how to get the top script working? I would appreciate it so much.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
class Screen
{
private:
Adafruit_SSD1306 display;
unsigned long startTime = 0;
public :
Screen(){
this->display = Adafruit_SSD1306(128, 64, &Wire, -1);
}
void init(){
//Initialize the screen
this->display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
this->display.setTextSize(1);
this->display.setTextColor(SSD1306_WHITE);
this->display.clearDisplay();
this->output(60,30,":)))))");
this->display.display();
}
void output(int x, int y, String S){
this->display.setCursor(x, y);
this->display.print(S);
this->display.display();
}
};
Screen screen;
void setup(){
screen.init();
}
void loop(){}