<?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[GO Plus motor shield source code]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">i have been testing some of the functions of the Goplus module and I must say that the source for the Atmel processor looks a bit strange to me (as does the test / sample for in the M5Stack Core module). If I look at the source for the go plus it declares an array :</p>
<p dir="auto">const int HubPort[6] = {A0,5,A1,6,A2,7};</p>
<p dir="auto">This is basically for the 3 hub ports. Which each have a analog input and a digital one. If I look at the schematics this is all just fine. A0 &amp; 5 are both for hub connector 1, etc, etc. But if I then look at the code there is a large switch statement when data is send to the go plus. In the sample program the do the following:</p>
<p dir="auto">M5.Lcd.fillScreen(BLACK);<br />
adInValue[0] = hub1_d_read_value((uint8_t)6);<br />
delay(50);<br />
<a href="//M5.Lcd.Fill" target="_blank" rel="noopener noreferrer nofollow ugc">//M5.Lcd.Fill</a>(0, 30 * i, 1);<br />
M5.Lcd.setCursor(0, 30 * 0, 1);<br />
M5.Lcd.print(adInValue[0]);</p>
<pre><code>adInValue[1] = hub1_d_read_value((uint8_t)7);
delay(50);
//M5.Lcd.Fill(0, 30 * i, 1);
M5.Lcd.setCursor(0, 30 * 1, 1);
M5.Lcd.print(adInValue[1]); 
</code></pre>
<p dir="auto">Which is the proccessed in the Goplus with :</p>
<pre><code>  case 6:  
          pinMode(HubPort[0],INPUT_PULLUP);
          adInValue[0] = analogRead(HubPort[0]);
           break;
  case 7:   pinMode(HubPort[1],INPUT_PULLUP);
           adInValue[1] = analogRead(HubPort[1]);
           break;
</code></pre>
<p dir="auto">And it seems to want to acces the correct inputs (HubPort[0] and HubPort[1], but that HubPort[1] isn't an analog input, so how can it do an analog read on that?</p>
<p dir="auto">and there are more things in the sample program (and the go plus source) that don't seem to add up. Is the code correct or just a wrong version? I know the original programmer left M5Stack, so could the code be wrong?</p>
]]></description><link>https://community.m5stack.com/topic/1985/go-plus-motor-shield-source-code</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 22:33:25 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1985.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 23 May 2020 23:10:20 GMT</pubDate><ttl>60</ttl></channel></rss>