I’m a Java programmer but I’m new on Arduino. By now I’m working on simple project just to get knowledge about its world. My current project is rotate a 3d box on my monitor using a gyro sensor.
The sketch for Arduino I wrote is really simple (see attached file) and basically perform the zero calibration of the gyro in setup() method and the measurement on loop() method.
On first test I found that the zero found on setup() method and the values the sensor give in loop() method when gyro is steady are not the same: my code detect angular speed but gyro was not moving.
After hours of attempts I got it: in order to show when my sketch is calibrating and when is reading I use a led. The led is switched on when calibration start and switched off just before setup() method end.
Removing this lines my sketch works fine! This behavior for me make no sense and I was starting think that my board was not working fine. But a friend of mine with more experience on microcontrollers told me this is normal for this type of device.
A the end the question is: is possible to avoid this type of problem? What the best practice in order to avoid this type of problem?
I want to by a 3-axis gyro and accelerometer by Sparkfun (MPU6050) that use I2C communication on digital pin: using this device the AC convertion is done by the chip itself so I should not have this problem… right?
I’m using Arduino Ethernet R3 board and 2-axis gyro from Tinker kit.
GyroScope.ino (2.2 KB)