How do I make my MPU6050 sensor to only calculate 0 - 90 degrees?

I am using MPU6050 to obtain specific angle which does not start from 0 - 360 degrees.

I want to make it read the angle from 0 if tilted from the right, (0-90) and
I want to make it read the angle from 0 if tilted from the left too (0-90)
Is it possible?
Or is it possible to alter it in blynk or arduino?

To limit the angle of the MPU6050 to a range of 0-90 degrees, you can use the following approach:

  1. Read the raw pitch and roll values from the sensor.

  2. Convert these raw values to angles in degrees using the appropriate conversion formulas.

  3. Use an if-else statement to check if the pitch and roll angles are greater than 90 degrees or less than 0 degrees.

  4. If the angles are out of the desired range, set them to 90 or 0 respectively.

Thanks.
But what if I want to make it shows
0 if it reads 365
1 if it reads 364
2 if it reads 363
3 - 90… until 275
but if the original value is 0-90, I want it still to show 0-90

I couldn’t get the result to come out as I wanted, maybe there is redundancy but I could not get my head to solve it

So if the angle is 0-90, display it as is, and if the angle is greater than 90, go in the opposite direction, for example, 91 = 1, 92 = 2, until 180 = 90, something like the protractor, right?

Yes it’s something like a protractor but not exactly.
I have included a picture since I don’t! think I can explain it clearly with words.
The MPU6050 works by measuring angles in 360 degrees, and the way it measures is different from how we tilt it.
What I want is the diagram below.

photo_2023-01-17_17-30-03|511x500

The 0-180 degrees?

The first diagram is how the MPU6050 reads the angle which is 360
If I tilt it from the left to the right, it will read 0 - 180
If I tilt it from the right to the left, it will read 360 - 180
Basically I just want it to read 180 degrees only (flat floor) but with specific outcome, which is if i tilt it from the right, it will start with 0 until 90 instead of starting from 360.

To change an angle from a range of 180-360 degrees to a range of 0-90 degrees, you can subtract 180 from the angle. This will shift the angle by 180 degrees, causing any value between 180 and 360 to be mapped to a value between 0 and 180. If you want to map it to 0-90, you can divide the result by 2.
For example,

if angle >= 180 and angle <= 360
{
    angle = (angle - 180) / 2;
}