<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MPU6050初始化失败]]></title><description><![CDATA[<pre><code>/* Get all possible data from MPU6050
 * Accelerometer values are given as multiple of the gravity [1g = 9.81 m/s²]
 * Gyro values are given in deg/s
 * Angles are given in degrees
 * Note that X and Y are tilt angles and not pitch/roll.
 *
 * License: MIT
 */

#include "Wire.h"
#include &lt;MPU6050_light.h&gt;

MPU6050 mpu(Wire);

unsigned long timer = 0;

void setup() {
  Serial.begin(115200);
  Wire.begin(18, 19);
  
  byte status = mpu.begin();
  Serial.print(F("MPU6050 status: "));
  Serial.println(status);
  while(status!=0){
    Serial.println("Initial MPU6050 error!");
    delay(1000);
  } // stop everything if could not connect to MPU6050
  
  Serial.println(F("Calculating offsets, do not move MPU6050"));
  delay(1000);
  mpu.calcOffsets(true,true); // gyro and accelero
  Serial.println("Done!\n");
  
}

void loop() {
  mpu.update();

  if(millis() - timer &gt; 1000){ // print data every second
    Serial.print(F("TEMPERATURE: "));Serial.println(mpu.getTemp());
    Serial.print(F("ACCELERO  X: "));Serial.print(mpu.getAccX());
    Serial.print("\tY: ");Serial.print(mpu.getAccY());
    Serial.print("\tZ: ");Serial.println(mpu.getAccZ());
  
    Serial.print(F("GYRO      X: "));Serial.print(mpu.getGyroX());
    Serial.print("\tY: ");Serial.print(mpu.getGyroY());
    Serial.print("\tZ: ");Serial.println(mpu.getGyroZ());
  
    Serial.print(F("ACC ANGLE X: "));Serial.print(mpu.getAccAngleX());
    Serial.print("\tY: ");Serial.println(mpu.getAccAngleY());
    
    Serial.print(F("ANGLE     X: "));Serial.print(mpu.getAngleX());
    Serial.print("\tY: ");Serial.print(mpu.getAngleY());
    Serial.print("\tZ: ");Serial.println(mpu.getAngleZ());
    Serial.println(F("=====================================================\n"));
    timer = millis();
  }
}
</code></pre>
<p dir="auto"><img src="/forum/assets/uploads/files/1761615483177-a8a0a774-54ad-4360-9d33-87f98e997753-image.png" alt="a8a0a774-54ad-4360-9d33-87f98e997753-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://fishros.org.cn/forum/topic/4613/mpu6050初始化失败</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 01:13:19 GMT</lastBuildDate><atom:link href="https://fishros.org.cn/forum/topic/4613.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Oct 2025 09:09:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to MPU6050初始化失败 on Wed, 05 Nov 2025 10:37:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fishros.org.cn/forum/uid/27056">@1223386926</a> 改为0x6A虽然不会报错，但无法读取有效的数值。根本原因在于用错了库，不应该使用https://github.com/rfetick/MPU6050_light.git，而是应该https://github.com/fishros/MPU6050_light.git。<br />
<img src="/forum/assets/uploads/files/1762339023705-e4b830da-4cdd-4262-8d7b-e2580a8303ff-image.png" alt="e4b830da-4cdd-4262-8d7b-e2580a8303ff-image.png" class=" img-fluid img-markdown" /> <img src="%E5%9B%BE%E7%89%87%E5%9C%B0%E5%9D%80" alt="替代文字" class=" img-fluid img-markdown" />。<br />
换完之后，就可以按教程中的代码读取数值：<br />
<img src="/forum/assets/uploads/files/1762339061568-872171f9-a41a-44d1-8b4c-b5293335c092-image.png" alt="872171f9-a41a-44d1-8b4c-b5293335c092-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://fishros.org.cn/forum/post/19223</link><guid isPermaLink="true">https://fishros.org.cn/forum/post/19223</guid><dc:creator><![CDATA[1223386926]]></dc:creator><pubDate>Wed, 05 Nov 2025 10:37:45 GMT</pubDate></item><item><title><![CDATA[Reply to MPU6050初始化失败 on Wed, 29 Oct 2025 12:43:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fishros.org.cn/forum/uid/27056">@1223386926</a> 在 <a href="/forum/post/19196">MPU6050初始化失败</a> 中说：</p>
<blockquote>
<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fishros.org.cn/forum/uid/27056">@1223386926</a> 在 <a href="/forum/post/19195">MPU6050初始化失败</a> 中说：</p>
<blockquote>
<p dir="auto">需要修改MPU6050默认地址，文件MPU6050_light.h<br />
// #define MPU6050_ADDR                  0x68<br />
#define MPU6050_ADDR                  0x6a<br />
<img src="/forum/assets/uploads/files/1761741480637-cd9d3119-a711-4289-937c-562a5c3c063a-image.png" alt="cd9d3119-a711-4289-937c-562a5c3c063a-image.png" class=" img-fluid img-markdown" /></p>
</blockquote>
<p dir="auto">检测地址</p>
<pre><code>#include "Wire.h"
#include &lt;MPU6050_light.h&gt;

void setup() {
  Serial.begin(115200);
  Wire.begin(18, 19); // 使用您的引脚
  delay(1000);
  
  Serial.println("I2C Scanner Starting...");
}

void loop() {
  byte error, address;
  int nDevices = 0;

  Serial.println("Scanning I2C bus...");
  
  for(address = 1; address &lt; 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address &lt; 16) Serial.print("0");
      Serial.print(address, HEX);
      Serial.println(" !");
      
      if (address == 0x68 || address == 0x69) {
        Serial.println("&gt;&gt;&gt; This is likely an MPU6050! &lt;&lt;&lt;");
      }
      nDevices++;
    }
  }
  
  if (nDevices == 0) {
    Serial.println("No I2C devices found!");
  } else {
    Serial.println("Scan complete.");
  }
  Serial.println("-------------------");
  delay(3000);
}
</code></pre>
</blockquote>
<p dir="auto"><img src="/forum/assets/uploads/files/1761741705047-2698c065-ef0b-4924-89d1-4ae4220c57ba-image.png" alt="2698c065-ef0b-4924-89d1-4ae4220c57ba-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://fishros.org.cn/forum/post/19197</link><guid isPermaLink="true">https://fishros.org.cn/forum/post/19197</guid><dc:creator><![CDATA[1223386926]]></dc:creator><pubDate>Wed, 29 Oct 2025 12:43:13 GMT</pubDate></item><item><title><![CDATA[Reply to MPU6050初始化失败 on Wed, 29 Oct 2025 12:40:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://fishros.org.cn/forum/uid/27056">@1223386926</a> 在 <a href="/forum/post/19195">MPU6050初始化失败</a> 中说：</p>
<blockquote>
<p dir="auto">需要修改MPU6050默认地址，文件MPU6050_light.h<br />
// #define MPU6050_ADDR                  0x68<br />
#define MPU6050_ADDR                  0x6a<br />
<img src="/forum/assets/uploads/files/1761741480637-cd9d3119-a711-4289-937c-562a5c3c063a-image.png" alt="cd9d3119-a711-4289-937c-562a5c3c063a-image.png" class=" img-fluid img-markdown" /></p>
</blockquote>
<p dir="auto">检测地址</p>
<pre><code>#include "Wire.h"
#include &lt;MPU6050_light.h&gt;

void setup() {
  Serial.begin(115200);
  Wire.begin(18, 19); // 使用您的引脚
  delay(1000);
  
  Serial.println("I2C Scanner Starting...");
}

void loop() {
  byte error, address;
  int nDevices = 0;

  Serial.println("Scanning I2C bus...");
  
  for(address = 1; address &lt; 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address &lt; 16) Serial.print("0");
      Serial.print(address, HEX);
      Serial.println(" !");
      
      if (address == 0x68 || address == 0x69) {
        Serial.println("&gt;&gt;&gt; This is likely an MPU6050! &lt;&lt;&lt;");
      }
      nDevices++;
    }
  }
  
  if (nDevices == 0) {
    Serial.println("No I2C devices found!");
  } else {
    Serial.println("Scan complete.");
  }
  Serial.println("-------------------");
  delay(3000);
}
</code></pre>
]]></description><link>https://fishros.org.cn/forum/post/19196</link><guid isPermaLink="true">https://fishros.org.cn/forum/post/19196</guid><dc:creator><![CDATA[1223386926]]></dc:creator><pubDate>Wed, 29 Oct 2025 12:40:51 GMT</pubDate></item><item><title><![CDATA[Reply to MPU6050初始化失败 on Wed, 29 Oct 2025 12:38:08 GMT]]></title><description><![CDATA[<p dir="auto">需要修改MPU6050默认地址，文件MPU6050_light.h<br />
// #define MPU6050_ADDR                  0x68<br />
#define MPU6050_ADDR                  0x6a<br />
<img src="/forum/assets/uploads/files/1761741480637-cd9d3119-a711-4289-937c-562a5c3c063a-image.png" alt="cd9d3119-a711-4289-937c-562a5c3c063a-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://fishros.org.cn/forum/post/19195</link><guid isPermaLink="true">https://fishros.org.cn/forum/post/19195</guid><dc:creator><![CDATA[1223386926]]></dc:creator><pubDate>Wed, 29 Oct 2025 12:38:08 GMT</pubDate></item></channel></rss>