Not 100% what you're trying to do with it, but this works:
I think I'm using a different LCD library to you so yours might need to be thumbed into this.
#include <LiquidCrystal_I2C.h>
class PCI {
public:
static PCI& Instance() {
if (PCI::pInstance == nullptr) PCI::pInstance = new PCI();
return *PCI::pInstance;
}
static LiquidCrystal_I2C lcd;
static void test() { Serial.println("Serial Test"); }
private:
static PCI* pInstance; // Static variable holding the pointer to the only instance of this
PCI() {
lcd.init();
lcd.backlight();
}
};
PCI* PCI::pInstance = nullptr;
LiquidCrystal_I2C PCI::lcd(0x27,16,2);
void setup() {
Serial.begin(115200);
PCI::test();
PCI::Instance().lcd.print("LCD Test");
}
void loop() { }