I'm testing the basic gyro functionality of the Uno Wifi R2. Using the "SimpleGyroscope" sketch from LSM6DS3 library and I don't think it reads precisely. With Uno sitting flat on my desk and without touching or moving anything, the serial monitor shows Z degrees value at around 3.5, and it wiggles slightly between 3.45 and 3.55...which is OK i guess - but if I tilt the Arduino slowly to its left side for example, the reading on the serial monitor goes in increments looking like this
-4.5
-22
-5.5
-3.5
and so on. And this is when I tilt it very very slowly. When I place ardiono on its left side, standing on its headers, it shows numbers like 30 or 40.....
The "gyro" is actually a rate gyro, meaning it measures the rate of rotation, not rotation angle.
Each axis has a zero offset which varies with temperature and other factors, which has to be determined and subtracted from subsequent measurements. The offsets are usually determined at startup by averaging some number of readings.
Look at the documentation or code for the sensor library you are using to determine exactly what the library is doing.
And if it shows "rate of rotation" - why is there a number when it just sits on the table, if has 3.5 degree value when flat on the table, what rate of rotation is present at that point?
The library is the minimal possible, and does not determine or subtract the zero offset.
It is quite involved to determine 3D orientations, and there are other libraries for that. To get them working at all will require some effort on your part, because each sensor has unique errors and has to be individually calibrated.
And that's a problem. The rate gyro is supposed to bleed off the charge it built up from movement as it just sits there.
Typically I buy 3 to 5 hobby grade MPU's to get one that works good; except for the LSM9DS1. One of the things I look for is after a motion disturbance, does the X/Y gyros charge bleed off. For Z remember the earth is roating and is always feeling some angular momentum.
With IMU's, it is best to get the best raw readings. If the gyro charge does not bleed off your base-line reading is going to be garbage and all the other math will be filled with errors.
Still just reading angles you don't need the gyros.