完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
首先我初始化它
代码:全选uint8_t MPU6050_Init(uint8_t slave_addr) { uint8_t result; Wire.setClock(400000); Wire.begin(); // initialize device Serial.println("Initializing MPU6050..."); mpu.initialize(); // verify connection result = mpu.testConnection(); if (result) Serial.println("Connection successful"); else { Serial.println("Connection failed"); return result; } // load and configure the DMP Serial.println("Initializing DMP..."); result = mpu.dmpInitialize(); //At this point I get // X Accel Y Accel Z Accel X Gyro Y Gyro Z Gyro //OFFSETS -3484, -5361, 768, 33, -36, 31 // supply your own gyro offsets here, scaled for min sensitivity mpu.setXGyroOffset(33); mpu.setYGyroOffset(-36); mpu.setZGyroOffset(-31); mpu.setXAccelOffset(-3484); mpu.setYAccelOffset(-5361); mpu.setZAccelOffset(768); // 1688 factory default for my test chip // make sure it worked (returns 0 if so) if (result == 0) { // Calibration Time: generate offsets and calibrate our MPU6050 mpu.CalibrateAccel(6); mpu.CalibrateGyro(6); mpu.PrintActiveOffsets(); // turn on the DMP, now that it's ready Serial.println("Enabling DMP..."); mpu.setDMPEnabled(true); result = mpu.getIntStatus(); // set our DMP Ready flag so the main loop() function knows it's okay to use it Serial.println("DMP ready! Waiting for first interrupt..."); dmpReady = true; // get expected DMP packet size for later comparison packetSize = mpu.dmpGetFIFOPacketSize(); } else { // ERROR! // 1 = initial memory load failed // 2 = DMP configuration updates failed // (if it's going to break, usually the code will be 1) Serial.print("DMP Initialization failed (code "); Serial.print(result); Serial.println(")"); } return result; } |
|
相关推荐 |
|
只有小组成员才能发言,加入小组>>
414浏览 6评论
346浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
329浏览 5评论
330浏览 4评论
313浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-20 04:50 , Processed in 0.691954 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号