Hello,
I got the acceleration value using mpu6050 sensor. And I am going to use this to get the angle of the sensor.
The formula below has shown that angles can be obtained.
//Angle formula_1 /*float RADIAN_TO_DEGREES = 180/3.14139; float val_x = atan(accel_values.y/sqrt(pow(accel_values.x,2) + pow(accel_values.z,2))) * RADIAN_TO_DEGREES; //X slope float val_y = atan(accel_values.x/sqrt(pow(accel_values.y,2) + pow(accel_values.z,2))) * RADIAN_TO_DEGREES; //Y slope*/ //Angle formulal_2 float pitch = atan(accel_values.x / sqrt(accel_values.y^2+accel_values.z^2)); float roll = atan(accel_values.y/ sqrt(accel_values.x^2+ accel_values.z^2)); //NRF_LOG_INFO("Accel : %d, %d, %d", accel_values.x, accel_values.y, accel_values.z); //NRF_LOG_INFO("Gyro : %d, %d, %d", gyro_values.x, gyro_values.y, gyro_values.z); NRF_LOG_INFO("X-Angle : %f", pitch); NRF_LOG_INFO("Y-Angle : %f", roll);
However, as shown in the image below, the value does not appear and is output as blank.
Can you tell me what's wrong?
Thank you.