Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MPU6050_test Drone MPU6050_test acelerometro ... more
Revision 10:31cec9253c7c, committed 2019-08-15
- Comitter:
- ritarosakai
- Date:
- Thu Aug 15 03:29:07 2019 +0000
- Parent:
- 9:2dd52ac40c96
- Child:
- 11:7cccbf912a71
- Commit message:
- Fix doxygen
Changed in this revision
| MPU6050.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MPU6050.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MPU6050.cpp Thu Aug 15 03:22:38 2019 +0000
+++ b/MPU6050.cpp Thu Aug 15 03:29:07 2019 +0000
@@ -85,32 +85,3 @@
return _MPU6050.write(sad, &sub, 1, true) == 0 && _MPU6050.read(sad, buf, length) == 0;
}
-
-/* sample code for Nucleo-F042K6
-#include "mbed.h"
-#include "MPU6050.h"
-
-MPU6050 mpu(D7,D8);
-Serial pc(USBTX,USBRX);
-
-float gx,gy,gz,ax,ay,az;
-
-int main()
-{
- pc.baud(115200);
- if(mpu.getID()==0x68) {
- pc.printf("MPU6050 OK");
- wait(1);
- } else {
- pc.printf("MPU6050 error ID=0x%x\r\n",mpu.getID());
- while(1) {
- }
- }
- mpu.start();
- while(1) {
- mpu.read(&gx,&gy,&gz,&ax,&ay,&az);
- pc.printf("gx,gy,gz,ax,ay,az %.1f,%.1f,%.1f,%.2f,%.2f,%.2f\r\n",gx,gy,gz,ax,ay,az);
- wait(0.1);
- }
-}
-*/
--- a/MPU6050.h Thu Aug 15 03:22:38 2019 +0000
+++ b/MPU6050.h Thu Aug 15 03:29:07 2019 +0000
@@ -116,6 +116,33 @@
/**
*MPU6050 6 axis I2C sensor
+*
+*@code
+*#include "mbed.h"
+*#include "MPU6050.h"
+*
+*MPU6050 mpu(D7,D8);
+*
+*float gx,gy,gz,ax,ay,az;
+*
+*int main()
+*{
+* if(mpu.getID()==0x68) {
+* printf("MPU6050 OK");
+* wait(1);
+* } else {
+* printf("MPU6050 error ID=0x%x\r\n",mpu.getID());
+* while(1) {
+* }
+* }
+* mpu.start();
+* while(1) {
+* mpu.read(&gx,&gy,&gz,&ax,&ay,&az);
+* printf("gx,gy,gz,ax,ay,az %.1f,%.1f,%.1f,%.2f,%.2f,%.2f\r\n",gx,gy,gz,ax,ay,az);
+* wait(0.1);
+* }
+*}
+*@endcode
*/
class MPU6050
{