Adafruit LIS3DH Triple-Axis Accelerometer Breakout

Adafruit LIS3DH Triple-Axis Asselerometer Braekout

I have been doing a lot of research on this. my goal is to trigger a relay with the x axis and second relay with the y axis. can anyone point me in the direction how to get those values?

only posting the code so you can see what i am working with, one of the examples.

I am using the spi version its set up up for i2c as well you just comment it out what you need to config for one or the other. using a regular arduino uno.

I have been able to read the data on the Serial monitor

in the past i have just worked with triggering based off the voltage at said pin but this sensor uses data from all the axis i believe to get values

I was wondering if theirs a way to use the value from the serial

Serial.print(lis.x); this is where i found the value comes from by commenting it out

if you could point me in right direction i would be very thankful

please don't write the code for me i need to under stand why i am hitting a wall with it

// 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();

void setup(void) {
Serial.begin(9600);
while (!Serial) delay(10); // will pause Zero, Leonardo, etc until serial console opens

Serial.println("LIS3DH test!");

if (! lis.begin(0x18)) { // change this to 0x19 for alternative i2c address
Serial.println("Couldnt start");
while (1) yield();
}
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() {
lis.read(); // get X Y and Z data at once
// Then print out the raw data
Serial.print("X: "); Serial.print(lis.x); // this is the line my post is refereeing to
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);
}