<?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[M5 Stick C Plus2 - I dont seem to be getting pitch&#x2F;roll&#x2F;yaw]]></title><description><![CDATA[<p dir="auto">Hi, I'm very much a novice at this sort of thing but I'm having trouble getting the pitch/roll/yaw data from the StickCPlus2.</p>
<p dir="auto">The example file is missing this crucial detail. From what I can tell so far, the Accellerometer data, and the Gyro data is working fine, as per that example at<br />
<a href="https://github.com/m5stack/M5StickCPlus2/blob/master/examples/Basic/imu/imu.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5StickCPlus2/blob/master/examples/Basic/imu/imu.ino</a><br />
and that's all working great.</p>
<p dir="auto">but there's an obvious missing chunk in the example code related to rotational position, and so I looked at the earlier (M5StickCPlus) for clues<br />
<a href="https://github.com/m5stack/M5StickC-Plus/blob/master/examples/Basics/IMU/IMU.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5StickC-Plus/blob/master/examples/Basics/IMU/IMU.ino</a></p>
<p dir="auto">Now here we have a totally different approach, and so I blundered through migrating it a bit, past several errors - until I realised that my Plus2 is very different and relies more on M5Unified</p>
<p dir="auto">So I took a look at the integrated example there (in /M5Unified) and it's all very familiar from the Plus2 example except ...<br />
<a href="https://github.com/m5stack/M5Unified/blob/master/examples/Basic/Imu/Imu.ino" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Unified/blob/master/examples/Basic/Imu/Imu.ino</a><br />
at line 258 where the "mag" vars and array is clearly referenced, where it's missing from the Plus2 example.</p>
<p dir="auto">So on my Plus2 if I do something like is implied at line 258 of that file (IE:)</p>
<blockquote>
<p dir="auto">M5.Lcd.printf("ACCEL %0.2f %0.2f %0.2f\r\n", data.accel.x, data.accel.y, data.accel.z);<br />
M5.Lcd.printf("GYRO %0.2f %0.2f %0.2f\r\n", data.gyro.x, data.gyro.y, data.gyro.z);<br />
M5.Lcd.printf("MAG %0.2f %0.2f %0.2f\r\n", data.mag.x, data.mag.y, data.mag.z); // this is the problem</p>
</blockquote>
<p dir="auto">what I get is something very like the below image, where <em>no</em> rotational attitude data is available.</p>
<p dir="auto">So, can you advise where I'm going wrong here?  How do I access the equivalent of line 65 in the older example</p>
<blockquote>
<p dir="auto">M5.Lcd.printf(" %5.2f   %5.2f   %5.2f   ", pitch, roll, yaw);</p>
</blockquote>
<p dir="auto"><img src="https://files.catbox.moe/2dva7m.jpg" alt="missing rotational data" class=" img-fluid img-markdown" /></p>
<p dir="auto">Where am I going wrong here?</p>
<p dir="auto">thanks in advance!</p>
]]></description><link>https://community.m5stack.com/topic/6340/m5-stick-c-plus2-i-dont-seem-to-be-getting-pitch-roll-yaw</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 09:00:39 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6340.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 15 Apr 2024 23:22:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5 Stick C Plus2 - I dont seem to be getting pitch&#x2F;roll&#x2F;yaw on Wed, 17 Apr 2024 02:10:33 GMT]]></title><description><![CDATA[<p dir="auto">Well, I go the M5Unified example working. I'm not sure why I failed on that yesterday, nor which element in there causes it to function correctly where the simple test (above) fails. But I'm accepting the win and absorbing the nicer code into mine. 😉</p>
]]></description><link>https://community.m5stack.com/post/24836</link><guid isPermaLink="true">https://community.m5stack.com/post/24836</guid><dc:creator><![CDATA[Angstrom]]></dc:creator><pubDate>Wed, 17 Apr 2024 02:10:33 GMT</pubDate></item></channel></rss>