Function for multiple Sensor reads?

Hello,

I have been trying to construct a function to allow me to read 3 values from mutiple sensors but failed miserably so far, wondering it someone might be able to point me in the right direction?

I would like to be able to call the function like this:

readSHT(SHT1);
and for it to return the sensor values TP1, RH1, DP1 etc for their onward journey.

This is the dumb code I would like to try and make more elegant (and learn something :-))

#include <Sensirion.h>

Sensirion SHT1 = Sensirion(3, 14);
Sensirion SHT2 = Sensirion(4, 14);
Sensirion SHT3 = Sensirion(5, 14);
Sensirion SHT4 = Sensirion(6, 14);
Sensirion SHT5 = Sensirion(7, 14);
Sensirion SHT6 = Sensirion(8, 14);
Sensirion SHT7 = Sensirion(9, 14);

void setup () 
{  
}

void loop () 
{
    readSHT1();
    readSHT2();
    readSHT3();
    readSHT4();
    readSHT5();
    readSHT6();
    readSHT7();
    delay(10000);
    
}  


//************************************************************

void readSHT1()
{
  SHT1.measure(&TP1, &RH1, &DP1);
  Serial.print("Temperature: ");
  Serial.println(TP1);
  Serial.print("Humidity: ");
  Serial.println(RH1);
  Serial.print("Dew Point: ");
  Serial.println(DP1);
}

//************************************************************

Seems like a SH*T name for a variable :slight_smile: (sorry, could not resist)

One very basic solution is to use global variables to hold the values that are gathered by the sensors.

...R