I have esp8266 ic with MPU6050 .
i am use a github librery to connect both the modules
its work well for displaying PITCH and ROLL but its not display the YAW value.
How can i include YAW value in this code?
is it possible to calculate YAW value from both PITCH and ROLL.
The code is given below
`#include <Wire.h>
#include <ESP8266WiFi.h>
#include <MPU6050.h>
MPU6050 mpu;
int SCL_PIN=D1;
int SDA_PIN=D2;
void setup()
{
WiFi.forceSleepBegin();// turn off ESP8266 RF
delay(1);
Serial.begin(9600);
Serial.println("Initialize MPU6050");
while(!mpu.beginSoftwareI2C(SCL_PIN,SDA_PIN,MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
}
void loop()
{
// Read normalized values
Vector normAccel = mpu.readNormalizeAccel();
// Calculate Pitch & Roll
int pitch = -(atan2(normAccel.XAxis, sqrt(normAccel.YAxisnormAccel.YAxis + normAccel.ZAxisnormAccel.ZAxis))*180.0)/M_PI;
int roll = (atan2(normAccel.YAxis, normAccel.ZAxis)*180.0)/M_PI;
// Output
Serial.print(" Pitch = ");
Serial.print(pitch);
Serial.print(" Roll = ");
Serial.print(roll);
Serial.println();
delay(10);
}`