"for" loop doesn't work

Hi,
I want to use the for loop to readout five sensirion humidity sensors. So I want to read the sensor, convert it with “floattostring” and send it to pstring (which is a container for string data-> http://arduiniana.org).

Unfortunately I get a error message because I want to use “i” from the for loop for the sensor definition. What did I do wrong?

Here s the code:

#include <Sensirion.h>
float humidity;
float temp;
float dew;
#define clockPin 20
#define dataPin11  21
#define dataPin12  22
#define dataPin13  23
#define dataPin14  24
#define dataPin15  25
Sensirion tempSensor11 = Sensirion(dataPin11, clockPin);
Sensirion tempSensor12 = Sensirion(dataPin12, clockPin);
Sensirion tempSensor13 = Sensirion(dataPin13, clockPin);
Sensirion tempSensor14 = Sensirion(dataPin14, clockPin);
Sensirion tempSensor15 = Sensirion(dataPin15, clockPin);

#include <floatToString.h>
char floattostringbuffer[50];         //buffer for Pstring
int nachkomma;                        //number of decimals


//Pstring>
#include <PString.h>
char pstringbuffer[150];         //buffer for Pstring
int writebuffer;
//Pstring<


void setup()
{  Serial.begin(9600);
}

void loop()
{
  PString hum(pstringbuffer, sizeof(pstringbuffer)); //open container in PSTRING
  hum.begin();  //start container

  for (int i=11; i <= 15; i++){
    tempSensor[i].measure(&temp, &humidity, &dew);
    floatToString(floattostringbuffer, temp , nachkomma);
    hum += floattostringbuffer;
    hum += ";";
    floatToString(floattostringbuffer, humidity , nachkomma);
    hum += floattostringbuffer;
    hum += ";";
    floatToString(floattostringbuffer, dew , nachkomma);
    hum += floattostringbuffer;
    hum += ";";
    delay(20);
  }
}

I think a “for” loop works just fine, but I think that using it to address a non-array simply doesn’t work:

tempSensor[i].measure(&temp, &humidity, &dew);

Uncompiled, untested:

const byte N_SENSORS = 5;
const byte dataPins [N_SENSORS] = {21, 22, 23,24, 25};
Sensirion tempSensor [N_SENSORS];

void setup ()
{
  for (int i = 0; i < N_SENSORS; i++)  {
    tempSensor [i] =  Sensirion(dataPin [i], clockPin);
  }
// yadda yadda..

Thanks- I will try to implement that.