AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Arduino gyroscope11/30/2022 Wire.endTransmission(false) //restarts transmission to I2C slave device Wire.write(0x3B) // starting with register 0x3B (ACCEL_XOUT_H) Serial.begin(9600) //serial communication at 9600 bauds Wire.endTransmission(true) //ends transmission to I2C slave device Wire.write(0) // set to zero (wakes up the MPU-6050) Wire.beginTransmission(MPU) //begin transmission to I2C slave device Wire.begin() //initiate wire library and I2C Int AcXcal,AcYcal,AcZcal,GyXcal,GyYcal,GyZcal,tcal //calibration variables Int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ //16-bit integers #include //library includes mathematical functionsĬonst int MPU=0圆8 //I2C address of the MPU-6050 ( It can be converted to degrees by multiplying by 180 and dividing by pi) Program #include //library allows communication with I2C / TWI devices Roll is the rotation around x-axis and pitch is the rotation along y-axis.īoth are calculated using the equation below: Pitch and Roll calculation
0 Comments
Read More
Leave a Reply. |