<?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[How to get an IMU MPU6886 work at M5Paper?]]></title><description><![CDATA[<p dir="auto">I tried to get an M5 Stack MPU6886 to work on my M5Paper Unit. But without success.</p>
<p dir="auto">What did I do?</p>
<p dir="auto">Connected the IMU MPU6886 to Port A.</p>
<p dir="auto"><a href="https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Unit/IMU_Unit" target="_blank" rel="noopener noreferrer nofollow ugc">modified the example Code from M5 to the following</a></p>
<pre><code>#include &lt;M5EPD.h&gt;
#include "time.h"

#ifdef __cplusplus
extern "C"
{
  #include "IMU_6886.h"
}
#endif

IMU_6886 imu6886;

float accX = 0;
float accY = 0;
float accZ = 0;

float gyroX = 0;
float gyroY = 0;
float gyroZ = 0;

char string_buff[40];

float temp = 0;

void setup() {
  // put your setup code here, to run once:
  M5.begin();
  imu6886.Init(25, 32);

  
}

void loop() {
  // put your main code here, to run repeatedly:
  imu6886.getGyroData(&amp;gyroX,&amp;gyroY,&amp;gyroZ);
  Serial.print("gyroX: ");
  Serial.println(gyroX);
  imu6886.getAccelData(&amp;accX,&amp;accY,&amp;accZ);
  Serial.print("accX: ");
  Serial.println(accX);
  imu6886.getTempData(&amp;temp);
  Serial.print("Temp: ");
  Serial.println(temp);
  delay(1000);
}
</code></pre>
<p dir="auto">At the first line I changed M5EPD.h instead of M5Stack.h and changed I2C Port to 25/32</p>
<p dir="auto">The same within IMU_6886.cpp .</p>
<p dir="auto">Comparing M5EPD.h to M5Stack.h, the M5EPD has no I2C Class Reference to CommUtil .<br />
So I added these two lines into M5EPD.h together with an #include "utility/CommUtil.h" at the beginning of the code.</p>
<pre><code>    Button BtnR = Button(M5EPD_KEY_RIGHT_PIN, true, 10);

    // I2C
    CommUtil I2C = CommUtil();

    M5EPD_Driver EPD = M5EPD_Driver();
</code></pre>
<p dir="auto">CommUtil.h and CommUtil.cpp I copied from M5Stack/src/utility to the corresponding path of M5EPD.<br />
Within CommUtil.cpp I changed the include also to ../M5EPD.h".</p>
<p dir="auto">After doing these steps the Compiling process ends without any errors and I can upload the sketch to the unit.</p>
<p dir="auto">Looking at the serial monitor it does not display any valid values. Only 25 Temperature but it's not changing and the other values are zero.</p>
<p dir="auto">Doeas anyone have an example code for IMU6886 running together with M5 Paper or can give me some hints to get the example code for m5Stack  working on M5Paper?</p>
<p dir="auto">Regards Herb</p>
]]></description><link>https://community.m5stack.com/topic/4048/how-to-get-an-imu-mpu6886-work-at-m5paper</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 15:46:05 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4048.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 16 Feb 2022 18:14:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get an IMU MPU6886 work at M5Paper? on Thu, 17 Feb 2022 13:12:08 GMT]]></title><description><![CDATA[<p dir="auto">I switched over to this library <a href="https://github.com/tanakamasayuki/I2C_MPU6886" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/tanakamasayuki/I2C_MPU6886</a></p>
<p dir="auto">There is no modification of the EPD Library necessary. Now it works with there example code.</p>
]]></description><link>https://community.m5stack.com/post/16687</link><guid isPermaLink="true">https://community.m5stack.com/post/16687</guid><dc:creator><![CDATA[herb]]></dc:creator><pubDate>Thu, 17 Feb 2022 13:12:08 GMT</pubDate></item></channel></rss>