mpu6050 lecture

Dependencies:   MPU6050 mbed

Files at this revision

API Documentation at this revision

Comitter:
theilor
Date:
Fri Oct 28 18:02:32 2022 +0000
Commit message:
MPU5060

Changed in this revision

MPU6050.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU6050.lib	Fri Oct 28 18:02:32 2022 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/moklumbys/code/MPU6050/#9b414412b09e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Oct 28 18:02:32 2022 +0000
@@ -0,0 +1,38 @@
+
+#include "mbed.h"
+#include "MPU6050.h"
+ 
+DigitalOut myled(LED1);
+Serial pc(USBTX, USBRX);
+int AcceX, AcceY, AcceZ=0;
+
+int lol[3];
+
+MPU6050 mpu (p9, p10);
+
+int main() {
+    
+     pc.baud(600);
+     
+          mpu.setAcceleroRange(MPU6050_ACCELERO_RANGE_16G);
+    while(1) 
+    {
+  
+    // Lecture des acceleromettres en X ,Y ,Z
+      
+      AcceX = mpu.getAcceleroRawX()  ;
+      AcceY = mpu.getAcceleroRawY()  ;
+      AcceZ = mpu.getAcceleroRawZ()  ;
+      
+     
+       mpu.getAcceleroRaw (lol)  ;
+      
+
+        pc.printf("Valeur de x : %d  Valeur de y : %d  Valeur de z : %d   \n\r",AcceX,AcceY,AcceZ);
+      
+        pc.printf("Valeur du tableau : %d   %d  %d   \n\r",lol[0],lol[1],lol[2]);
+       
+
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Oct 28 18:02:32 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file