Lis3dh library not working

Hi it’s been a few days am on this and I have no clue what is going on. I am using the LIS3DH library in VS Code (dowloaded from PIO) and the code below.
Accel class in one file

#include "Arduino.h"
#include "Accel.h"

// Used for software SPI
#define LIS3DH_CLK 27
#define LIS3DH_MISO 39
#define LIS3DH_MOSI 26
// Used for hardware & software SPI
#define LIS3DH_CS 37

// software SPI
Adafruit_LIS3DH lis = Adafruit_LIS3DH(LIS3DH_CS, LIS3DH_MOSI, LIS3DH_MISO, LIS3DH_CLK);

Accel::Accel()
{
  delay(5000);
  Serial.println("LIS3DH test!");
  if (!lis.begin(0x18))
  { // change this to 0x19 for alternative i2c address
    Serial.println("Couldnt start ACCEL");
    while (1)
      yield();
  }
  // lis.setDataRate(LIS3DH_DATARATE_50_HZ);
  Serial.print("Data rate set to: ");
  switch (lis.getDataRate())
  {
  case LIS3DH_DATARATE_1_HZ:
    Serial.println("1 Hz");
    break;
  case LIS3DH_DATARATE_10_HZ:
    Serial.println("10 Hz");
    break;
  case LIS3DH_DATARATE_25_HZ:
    Serial.println("25 Hz");
    break;
  case LIS3DH_DATARATE_50_HZ:
    Serial.println("50 Hz");
    break;
  case LIS3DH_DATARATE_100_HZ:
    Serial.println("100 Hz");
    break;
  case LIS3DH_DATARATE_200_HZ:
    Serial.println("200 Hz");
    break;
  case LIS3DH_DATARATE_400_HZ:
    Serial.println("400 Hz");
    break;

  case LIS3DH_DATARATE_POWERDOWN:
    Serial.println("Powered Down");
    break;
  case LIS3DH_DATARATE_LOWPOWER_5KHZ:
    Serial.println("5 Khz Low Power");
    break;
  case LIS3DH_DATARATE_LOWPOWER_1K6HZ:
    Serial.println("16 Khz Low Power");
    break;
  }

  xvar = 0;
  yvar = 0;
  zvar = 0;
}

void Accel::acquire()
{
  lis.read();

  // Serial.print("fin accel   : ");
  // Serial.println(micros());

  sensors_event_t event;
  lis.getEvent(&event);

  xvar = event.acceleration.x;
  yvar = event.acceleration.y;
  zvar = event.acceleration.z;
}

Accel.h file

#ifndef Accel_h
#define Accel_h

#include "Arduino.h"
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>

class Accel
{
public:
  Accel();
  void acquire();
  void setaccelpin(int accelpin);
  int getaccelpin();
  float xvar;
  float yvar;
  float zvar;
};

#endif

Main file

#include <Arduino.h>
#include "Accel.h"

Accel _Accel;

void setup()
{
  Serial.begin(9600);
  Serial.print("Start");
}

void loop()
{
  _Accel.acquire();
  Serial.println(_Accel.xvar);
}

Every time I run this it is stuck in “could’nt start accel” however the pins are the correct one cause when I run this in Arduino with the library installed with the library manager it works fine.
Any idea what this could be ?

You like to live dangerous, doing stuff like in the constructor of the class before other stuff (framework internal stuff etc) is initialized (order of execution of constructors is not guarnateed) is like playing russian roulette.

What’s the platformio.ini?