GY-511 having trouble with Elevation Angle + reading I2C values on ESP32 Pico D4

Hi, I'm trying to use the GY-511 module for getting the Elevation angle of an object.
https://create.arduino.cc/projecthub/electropeak/make-a-digital-compass-w-gy-511-accelerometer-magnetometer-df9dc1
I found this using a google search but the code I'm using is from another site.

I modified the code from the second link above and for a while it worked great from what I could remember. I believe I was using an Arduino Pro Mini at the time. However, now that I am using an ESP32 Pico D4, I changed the I2C pins to what they should be by default and I have them plugged into the board in those respective pins.

I checked my addresses via I2C scanner program and they appear to be correct.
Any ideas what is wrong?

I'm only getting one static value rather than a dynamic one in the serial monitor:

Elevation Angle: -135
Elevation Angle: -135
Elevation Angle: -135
Elevation Angle: -135
Elevation Angle: -135
Elevation Angle: -135
Elevation Angle: -135
Elevation Angle: -135

Here is the code I'm using:

//allows you to communicate with I2C
#include<Wire.h>

#define SDA 21
#define SCL 22

const int MPU_addr = 0x19;
int16_t AcX, AcY, AcZ, Tmp, GyX, GyY, GyZ;

//values for determining correct angle with accelerometer
int minVal = 85;
int maxVal = 402;

double x;
int ElevationAngle; //elevation angle
double z;

void setup() {

  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);
  Wire.write(0);
  Wire.endTransmission(true);

  Serial.begin(115200);
}
void loop() {
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr, 14, true);

  AcX = Wire.read() << 8 | Wire.read();
  AcY = Wire.read() << 8 | Wire.read();
  AcZ = Wire.read() << 8 | Wire.read();

  int xAng = map(AcX, minVal, maxVal, -180, 180);
  int yAng = map(AcY, minVal, maxVal, -180, 180);
  int zAng = map(AcZ, minVal, maxVal, -180, 180);

  ElevationAngle = RAD_TO_DEG * (atan2(xAng, zAng));
  Serial.print("Elevation Angle: ");
  Serial.print(ElevationAngle);
  Serial.println();

  delay(2000);
}

I used the scanning program below:

// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
// Version 5, March 28, 2013
//    As version 4, but address scans now to 127.
//    A sensor seems to use address 120.
// Version 6, November 27, 2015.
//    Added waiting for the Leonardo serial communication.
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
 
#include <Wire.h>
 
 
void setup()
{
  Wire.begin();
 
  Serial.begin(115200);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}
 
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
 
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");
 
      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}

These are the I2C addresses I found:

Scanning...
I2C device found at address 0x19  !
I2C device found at address 0x1E  !
done

I'm not sure about the addressing for Wire.write and how it's selected.
The 2nd link in the first post though uses these addresses but it's for the GY-521 module and not GY-511 module.

//values for determining correct angle with accelerometer
int minVal = 85;
int maxVal = 402;

Could it be my initial values that are causing a constant result to appear?
I know each module needs a little offset calibration.

I also checked the module and it's getting a proper 3.3 volts supplied to it.
The fact that I could use the I2C scanner program and that it gave me the addresses says it's online.
So I don't get why I'm getting a constant result.

I am looking into getting the MPU9255.
https://bit.ly/3akyZAm
http://arduinolearning.com/code/arduino-and-mpu-9255-sensor-example.php

I am using this as an angle tilt sensor.