GO Plus motor shield source code

  • Hi,

    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 :

    const int HubPort[6] = {A0,5,A1,6,A2,7};

    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 & 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:

    adInValue[0] = hub1_d_read_value((uint8_t)6);
    //M5.Lcd.Fill(0, 30 * i, 1);
    M5.Lcd.setCursor(0, 30 * 0, 1);

    adInValue[1] = hub1_d_read_value((uint8_t)7);
    //M5.Lcd.Fill(0, 30 * i, 1);
    M5.Lcd.setCursor(0, 30 * 1, 1);

    Which is the proccessed in the Goplus with :

      case 6:  
              adInValue[0] = analogRead(HubPort[0]);
      case 7:   pinMode(HubPort[1],INPUT_PULLUP);
               adInValue[1] = analogRead(HubPort[1]);

    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?

    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?

  • Banned

    This post is deleted!