expression must have pointer-to-object type

Hello!

Currently, I am trying to save values in an array and use them in one of my functions inside the class Sequencer.
The error message I get is: expression must have pointer-to-object type. Could anyone explain to me what I do wrong?

Arrays inside the header file:

  std::array<int, 8> bit1{{0, 1, 0, 1, 0, 1, 0, 1}};
  std::array<int,8> bit2{{0, 0, 1, 1, 0, 0, 1, 1}};
  std::array<int,8> bit3{{0, 0, 0, 0, 1, 1, 1, 1}};

Function:

void Sequencer::muxUpdate()
{

    for (int i{0}; i < 8; ++i)
    {
      //  bit1 = bitRead(i, 0);
      //  bit2 = bitRead(i, 1);
      //  bit3 = bitRead(i, 2);
    /*  bit1 = 1;
      bit2 = 1;
      bit3 = 0; */
        digitalWrite(pin_Out_S0, bit1[2]);
        digitalWrite(pin_Out_S1, bit2[2]);
        digitalWrite(pin_Out_S2, bit3[2]);

        digitalWrite(ledMuxCom, HIGH);
        buttonMuxState[i] = digitalRead(buttonMuxCom);
        potiMuxState[i] = analogRead(potiMuxCom);

        delay(70);
    }
}

Please post a complete sketch and supporting files that illustrates the error

Posting snippets is almost always a waste of time as they cannot be seen in context

Also, explain why you are trying to use std::array verses just the language's native array construct and why you have variable definitions (vs declarations) in a header file. See: What's the difference between declaring and defining in C and C++ - Cprogramming.com

The problem was solved, but for some reason, I was not able to delete the post.. Thank you for your help and response though! I was just redefining bit1, bit2 and bit3.. :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.