user69011: I have 8xMAX31856 and I am trying to use the Adafruit library. Instead of writing all 8 thermocouple channels each time in code (and wasting memory), I want to store the objects in an array and loop through them periodically.
Here is my code:
Adafruit_MAX31856 TCouple1 = Adafruit_MAX31856(2,11,12,13);
Adafruit_MAX31856 TCouple2 = Adafruit_MAX31856(3,11,12,13);
Adafruit_MAX31856 TCouple3 = Adafruit_MAX31856(4,11,12,13);
Adafruit_MAX31856 TCouple4 = Adafruit_MAX31856(5,11,12,13);
Adafruit_MAX31856 TCouple5 = Adafruit_MAX31856(6,11,12,13);
Adafruit_MAX31856 TCouple6 = Adafruit_MAX31856(7,11,12,13);
Adafruit_MAX31856 TCouple7 = Adafruit_MAX31856(8,11,12,13);
Adafruit_MAX31856 TCouple8 = Adafruit_MAX31856(9,11,12,13);

char* thermocouples[] = {TCouple1, TCouple2, TCouple3, TCouple4, TCouple5, TCouple6, TCouple7, TCouple8};

however, I am met with this error on compile:
cannot convert 'Adafruit_MAX31856' to 'char*' in initialization

Why can I not store these variables in an array and call on them later? Is there another way to do this? They work on SPI logic...

user42015: You CAN store them in an array, but NOT in an array of pointers to characters. That is just the wrong type. Try
Adafruit_MAX31856 thermocouples[] = {TCouple1, ...}

or even ditch the first declarations and use
Adafruit_MAX31856 thermocouples[] = {
    Adafruit_MAX31856(2,11,12,13),
    Adafruit_MAX31856(3,11,12,13),
    Adafruit_MAX31856(4,11,12,13),
    ...
};

I don't have that library installed, but I tried compiling this pattern with the Bounce2 library and it works. That looks like this:
Bounce buttons[] = {
    Bounce(),
    Bounce(),
    Bounce()
};


69011: <p>I have 8xMAX31856 and I am trying to use the Adafruit library. Instead of writing all 8 thermocouple channels each time in code (and wasting memory), I want to store the objects in an array and loop through them periodically.</p>
<p>Here is my code:</p>
<pre><code>Adafruit_MAX31856 TCouple1 = Adafruit_MAX31856(2,11,12,13);
Adafruit_MAX31856 TCouple2 = Adafruit_MAX31856(3,11,12,13);
Adafruit_MAX31856 TCouple3 = Adafruit_MAX31856(4,11,12,13);
Adafruit_MAX31856 TCouple4 = Adafruit_MAX31856(5,11,12,13);
Adafruit_MAX31856 TCouple5 = Adafruit_MAX31856(6,11,12,13);
Adafruit_MAX31856 TCouple6 = Adafruit_MAX31856(7,11,12,13);
Adafruit_MAX31856 TCouple7 = Adafruit_MAX31856(8,11,12,13);
Adafruit_MAX31856 TCouple8 = Adafruit_MAX31856(9,11,12,13);

char* thermocouples[] = {TCouple1, TCouple2, TCouple3, TCouple4, TCouple5, TCouple6, TCouple7, TCouple8};
</code></pre>
<p>however, I am met with this error on compile:</p>
<pre><code>cannot convert 'Adafruit_MAX31856' to 'char*' in initialization
</code></pre>
<p>Why can I not store these variables in an array and call on them later? Is there another way to do this? They work on SPI logic...</p>
 42015: <p>You CAN store them in an array, but NOT in an array of pointers to characters. That is just the wrong type. Try</p>
<pre><code>Adafruit_MAX31856 thermocouples[] = {TCouple1, ...}
</code></pre>
<p>or even ditch the first declarations and use</p>
<pre><code>Adafruit_MAX31856 thermocouples[] = {
    Adafruit_MAX31856(2,11,12,13),
    Adafruit_MAX31856(3,11,12,13),
    Adafruit_MAX31856(4,11,12,13),
    ...
};
</code></pre>
<p>I don't have that library installed, but I tried compiling this pattern with the <code>Bounce2</code> library and it works. That looks like this:</p>
<pre><code>Bounce buttons[] = {
    Bounce(),
    Bounce(),
    Bounce()
};
</code></pre>
