<?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[&quot;Unit Scales&quot; example in github doesn&#x27;t work]]></title><description><![CDATA[<p dir="auto">I use m5stack grey with "Unit Scale"  <a href="%5Bhttps://docs.m5stack.com/en/unit/scales%5D(https://docs.m5stack.com/en/unit/scales)">link</a>. after using arduino sketch compile and upload code , it shows "scales not connect".<br />
but i use easyloader to burn firmware it works fine.<br />
so what is the difference between them.<br />
and i use i2c to scan it shows 0x26</p>
]]></description><link>https://community.m5stack.com/topic/4652/unit-scales-example-in-github-doesn-t-work</link><generator>RSS for Node</generator><lastBuildDate>Tue, 12 May 2026 03:29:43 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4652.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 27 Sep 2022 08:29:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &quot;Unit Scales&quot; example in github doesn&#x27;t work on Fri, 30 Sep 2022 14:30:52 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/pop-k" aria-label="Profile: pop-k">@<bdi>pop-k</bdi></a></p>
<p dir="auto">I am glad to hear that. Thank you for reporting back.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/m5stack" aria-label="Profile: m5stack">@<bdi>m5stack</bdi></a> : please check this <a href="https://github.com/m5stack/M5Unit-Scales/pull/2" target="_blank" rel="noopener noreferrer nofollow ugc">pull-request</a>. Thank you.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/18752</link><guid isPermaLink="true">https://community.m5stack.com/post/18752</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Fri, 30 Sep 2022 14:30:52 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;Unit Scales&quot; example in github doesn&#x27;t work on Wed, 28 Sep 2022 03:44:03 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much .   work like a charm!!</p>
]]></description><link>https://community.m5stack.com/post/18750</link><guid isPermaLink="true">https://community.m5stack.com/post/18750</guid><dc:creator><![CDATA[pop-k]]></dc:creator><pubDate>Wed, 28 Sep 2022 03:44:03 GMT</pubDate></item><item><title><![CDATA[Reply to &quot;Unit Scales&quot; example in github doesn&#x27;t work on Tue, 27 Sep 2022 19:44:18 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/pop-k" aria-label="Profile: pop-k">@<bdi>pop-k</bdi></a></p>
<p dir="auto">it looks like newer ESP32 Arduino libraries added an overloaded <code>begin()</code> function to also allow to setup an I2C <strong>slave</strong>. Whether the <code>begin()</code> for an I2C <strong>master</strong> or <strong>slave</strong> is called is determined by the linker by looking at the parameter types.</p>
<p dir="auto">I2C master: parameter types are <code>int</code>, <code>int</code>, <code>uint32_t</code></p>
<pre><code>bool TwoWire::begin(int sda = -1, int scl = -1, uint32_t frequency = 0U)
</code></pre>
<p dir="auto">I2C slave: parameter types are <code>uint8_t</code>, <code>int</code>, <code>int</code>, <code>uint32_t</code></p>
<pre><code>bool TwoWire::begin(uint8_t slaveAddr, int sda = -1, int scl = -1, uint32_t frequency = 0U)
</code></pre>
<p dir="auto">Now some unit libraries (including the one for unit scales) are calling the <code>begin()</code> like this:</p>
<pre><code>_wire-&gt;begin(_sda, _scl, 400000UL);
</code></pre>
<p dir="auto">where <code>_sda</code> and <code>_scl</code> are defined as <code>uint8_t</code>.</p>
<p dir="auto">So the first parameter <code>_sda</code> is an <code>uint8_t</code> and the first parameter of the <code>begin()</code> for an I2C <strong>slave</strong> also is an <code>uint8_t</code> (whereas the first parameter for an I2C <strong>master</strong> is an <code>int</code>) therefore the linker calls the <code>begin()</code> of the I2C slave. But we need it to call the <code>begin()</code> of an I2C master.</p>
<p dir="auto">In short, try to modify below line in file <code> M5Unit-Scales/src/M5_Scales.cpp</code> from:</p>
<pre><code>_wire-&gt;begin(_sda, _scl, 400000UL);
</code></pre>
<p dir="auto">to</p>
<pre><code>_wire-&gt;begin((int)_sda, (int)_scl, 400000UL);
</code></pre>
<p dir="auto">to force the linker to call the I2C <strong>master</strong> <code>begin()</code>.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/18745</link><guid isPermaLink="true">https://community.m5stack.com/post/18745</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Tue, 27 Sep 2022 19:44:18 GMT</pubDate></item></channel></rss>