Single readout from serial monitor

Hi! I have an Adafruit LIS3DH (Arduino | Adafruit LIS3DH Triple-Axis Accelerometer Breakout | Adafruit Learning System) and I’m just testing it using the example provided here in the web editor (se code below) with my Arduino Uno. It was working fine with readouts from x, y and z however now it suddenly won’t print anything to serial monitor except the first Serial.println(“LIS3DH test!”) line. Everything else is ignored, I’ve tried putting serial print snippets all over the code to troubleshoot but to no avail. Haven’t found anything besides questions about how to limit prints to serial monitor or serial monitor not printing enything at all, nothing about only printing one line and ignoring the rest.

// Basic demo for accelerometer readings from Adafruit LIS3DH

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

// Used for software SPI
//#define LIS3DH_CLK 13
//#define LIS3DH_MISO 12
//#define LIS3DH_MOSI 11
// Used for hardware & software SPI
//#define LIS3DH_CS 10

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

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif

void setup(void) {
#ifndef ESP8266
  while (!Serial);     // will pause Zero, Leonardo, etc until serial console opens
#endif

  Serial.begin(9600);
  Serial.println("LIS3DH test!");
  
  if (! lis.begin(0x19)) {   // change this to 0x19 for alternative i2c address
    Serial.println("Couldnt start");
    while (1);
  }
  Serial.println("LIS3DH found!");
  
  lis.setRange(LIS3DH_RANGE_4_G);   // 2, 4, 8 or 16 G!
  
  Serial.print("Range = "); Serial.print(2 << lis.getRange());  
  Serial.println("G");
}

void loop() {
  Serial.print("BAJSBAJS");
  lis.read();      // get X Y and Z data at once
  // Then print out the raw data
  Serial.print("X:  "); Serial.print(lis.x); 
  Serial.print("  \tY:  "); Serial.print(lis.y); 
  Serial.print("  \tZ:  "); Serial.print(lis.z); 

  /* Or....get a new sensor event, normalized */ 
  sensors_event_t event; 
  lis.getEvent(&event);
  
  /* Display the results (acceleration is measured in m/s^2) */
  Serial.print("\t\tX: "); Serial.print(event.acceleration.x);
  Serial.print(" \tY: "); Serial.print(event.acceleration.y); 
  Serial.print(" \tZ: "); Serial.print(event.acceleration.z); 
  Serial.println(" m/s^2 ");

  Serial.println();
 
  delay(200); 
}

The obvious first thing to check is the wiring.
Check it then check it again

Well I can't take any photos and upload right now but I can tell you HOW it's connected. I have SCL to pin A5, SDA to pin A4 and 3.3V from arduino to Vin on the LIS3DH and ground to ground... I tried to exchange all the wires but it resulted with the same problem. However why would I get a single print to serial monitor if the wires aren't connected properly?

You might try the I2CScanner to make certain the device, address, and wiring are all okay.

by "a single line" do you mean that it fails to print after

if (! lis.begin(0x19)) {   // change this to 0x19 for alternative i2c address
    Serial.println("Couldnt start");
    while (1);
  }
  Serial.println("LIS3DH found!");

Exactly, only the “LIS3DH test!” line is printed in the serial monitor.

PickyBiker:
You might try the I2CScanner to make certain the device, address, and wiring are all okay.

GitHub - todbot/arduino-i2c-scanner: Simple Arduino I2C scanner as described at http://todbot.com/blog/2009/11/29/i2cscanner-pde-arduino-as-i2c-bus-scanner/

I tried the I2CScanner but it relies on the Serial Monitor aswell, it only prints out the "I2CScanner ready!" and "starting scanning of I2C bus from "... And then nothing, I have been staring at it for 5 minutes.

Just to see if everything was okay I tried some basic examples like blink and AnalogSerialRead, and it took ages to upload them to the Uno. So what I'm going to do next is try to install the IDE and do some further testing, maybe the problem is the Web Editor.