Skip to content

Commit

Permalink
calculations done
Browse files Browse the repository at this point in the history
  • Loading branch information
samitha093 committed Oct 28, 2022
1 parent be79ccb commit 80a7c93
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 59 deletions.
Binary file modified .vs/GccApplication1/v14/.atsuo
Binary file not shown.
1 change: 0 additions & 1 deletion GccApplication1.atsln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
GccApplication1\I2C.h = GccApplication1\I2C.h
GccApplication1\MPU6050.h = GccApplication1\MPU6050.h
GccApplication1\MPU6050_cal.h = GccApplication1\MPU6050_cal.h
GccApplication1\USART.h = GccApplication1\USART.h
EndProjectSection
EndProject
Expand Down
2 changes: 1 addition & 1 deletion GccApplication1/GccApplication1.cproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.39.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.44.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
Expand Down
25 changes: 0 additions & 25 deletions GccApplication1/MPU6050_cal.h

This file was deleted.

37 changes: 5 additions & 32 deletions GccApplication1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <stdlib.h> /* Include standard library file */
#include <stdio.h> /* Include standard library file */
#include "MPU6050.h" /* Include MPU6050 register define file */
#include "MPU6050_cal.h" /* Include MPU6050 Functions */
#include "I2C.h" /* Include I2C Functions */
#include "USART.h" /* Include USART Functions */

Expand Down Expand Up @@ -86,43 +85,17 @@ int main(){
Zg = Gyro_z/16.4;


rollangle=atan2(Ya,Za)*180/PI; // FORMULA FOUND ON INTERNET
pitchangle=atan2(Xa,sqrt(Ya*Ya+Za*Za))*256/PI; //FORMULA FOUND ON INTERNET
rollangle=atan2(Ya,Za)*180/PI;
pitchangle=atan2(Xa,sqrt(Ya*Ya+Za*Za))*256/PI;

//Using Complemetary Filter
roll=A*(roll+Xg*dt)+(1-A)*rollangle;//
pitch=A*(pitch+Yg*dt)+(1-A)*pitchangle;
//Using Complementary Filter
roll=A*(roll+Xg*dt)+(1-A)*rollangle;//
pitch=A*(pitch+Yg*dt)+(1-A)*pitchangle;


dtostrf( pitch, 3, 2, float_ );
sprintf(buffer,"Pitch = %s\n",float_);
USART_SendString(buffer);
printf("\n");
/*
dtostrf( Xa, 3, 2, float_ );
sprintf(buffer," Ax = %s g\t",float_);
USART_SendString(buffer);
dtostrf( Ya, 3, 2, float_ );
sprintf(buffer," Ay = %s g\t",float_);
USART_SendString(buffer);
dtostrf( Za, 3, 2, float_ );
sprintf(buffer," Az = %s g\t",float_);
USART_SendString(buffer);
dtostrf( Xg, 3, 2, float_ );
sprintf(buffer," Gx = %s%c/s\t",float_,0xF8);
USART_SendString(buffer);
dtostrf( Yg, 3, 2, float_ );
sprintf(buffer," Gy = %s%c/s\t",float_,0xF8);
USART_SendString(buffer);
dtostrf( Zg, 3, 2, float_ );
sprintf(buffer," Gz = %s%c/s\t\n",float_,0xF8);
USART_SendString(buffer);
*/
}
}

0 comments on commit 80a7c93

Please sign in to comment.