projet 5A ensil Johan Bouthayna Annas
Revision 1:8f6591373cfd, committed 2017-11-24
- Comitter:
- JohanBeverini
- Date:
- Fri Nov 24 11:30:50 2017 +0000
- Parent:
- 0:1d41bd249237
- Child:
- 2:f89067092cef
- Commit message:
- aa
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Nov 24 11:10:42 2017 +0000
+++ b/main.cpp Fri Nov 24 11:30:50 2017 +0000
@@ -5,20 +5,13 @@
Serial BT(PA_10, PA_9);
MPU6050 mpu6050;
+Ticker t;
DigitalOut myled(LED1);
-int main()
-{
- PC.baud(9600);
- PC.printf("Hello World !\n");
- BT.baud(9600);
- BT.printf("Connection BT\n");
-
-
-
-
- while(1) {
+float alpha, beta, gamma, R11, R12, R13, R21, R22, R23, R31, R32, R33, poidx, poidy, poidz, periode;
+
+void recup_MPU(void){
if(mpu6050.readByte(MPU6050_ADDRESS, INT_STATUS) & 0x01) { // check if data ready interrupt
mpu6050.readAccelData(accelCount); // Read the x/y/z adc values
@@ -70,5 +63,42 @@
PC.printf("gyroscope in Z = %u, or %f dps\n", (unsigned int)gyroCount[2], gz);
PC.printf("temperature = %u, or %f C\n", (unsigned int)tempCount, temperature);
+}
+
+void boucle(void){
+ recup_MPU();
+ alpha+=gx*periode;
+ beta+=gy*periode;
+ gamma+=gz*periode;
+
+
+}
+
+int main()
+{
+ PC.baud(9600);
+ PC.printf("Hello World !\n");
+ BT.baud(9600);
+ BT.printf("Connection BT\n");
+
+ periode=0.1;
+
+ alpha=0.0;
+ beta=0.0;
+ gamma=0.0;
+
+ recup_MPU();
+ poidx=ax;
+ poidy=ay;
+ poidz=az;
+
+
+ t.attach(&boucle, periode);
+
+
+
+ while(1) {
+
+
}
}