Teensy 3.5: using 2 SHT31 sensors simultaneously

Hi,

I am trying to use the teensy 3.5 to read two SHT31 sensors simulatneously, but am unable to read the second sensor. Is there a special way to set addresses for the data for the second sensor using i2c bus?
Also which pins would need pull ups ?

Below is the code for your reference:

#include <Arduino.h>
//#include <Wire.h>
#include "Adafruit_SHT31.h"
#include <SPI.h>
// #define lcd Serial2
#include <SoftwareSerial.h>

  SoftwareSerial lcd = SoftwareSerial(0, 7);  //lcd tx pin = 7
#include <i2c_t3.h>

Adafruit_SHT31 sht31a = Adafruit_SHT31();
Adafruit_SHT31 sht31b = Adafruit_SHT31();

void setup() {
  Serial.begin(9600);
 
Wire.begin(I2C_MASTER, 0x44, 33, 34);
Wire1.begin(I2C_MASTER, 0x45, 37, 38);
 
  SPI.begin(); // Init SPI bus
  while (!Serial)
    delay(10);     // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("SHT31 test");
  if (! sht31a.begin(0x44)) {    // first sensor with default address
    Serial.println("Couldn't find SHT31 #1");
    while (1) delay(1);
  }

  if (! sht31b.begin(0x45)) {    // second sensor with secondary address
    Serial.println("Couldn't find SHT31 #2");
    while (1) delay(1);
  }
  lcd.begin(9600); //initializes lcd
    lcd.write(0xFE); //screen size
  lcd.write(0xD1);
  lcd.write(16);
  lcd.write(2);
}


void loop() {
  float t = sht31a.readTemperature();
  float h = sht31a.readHumidity();
  float t2 = sht31b.readTemperature();
  float h2 = sht31b.readHumidity();

  if (! isnan(t)) {  // check if 'is not a number'
    Serial.print("Temp *C = "); Serial.println(t);
  } else { 
    Serial.println("Failed to read temperature");
  }
  delay (100);
   if (! isnan(t2)) {  // check if 'is not a number'
    Serial.print("Temp *C = "); Serial.println(t2);
  } else { 
    Serial.println("Failed to read temperature");
  }
  
  if (! isnan(h)) {  // check if 'is not a number'
    Serial.print("Hum. % = "); Serial.println(h);
 lcd.write(0xFE);
      lcd.write(0x58);
         lcd.print("Hum. % = "); lcd.println(h);
    
  } else { 
    Serial.println("Failed to read humidity");
  }
  delay (100);
    if (! isnan(h2)) {  // check if 'is not a number'
    Serial.print("Hum. % = "); Serial.println(h2);
 lcd.write(0xFE);
      lcd.write(0x58);
         lcd.print("Hum. % = "); lcd.println(h2);
    
  } else { 
    Serial.println("Failed to read humidity");
  Serial.println();
  delay(1000);
  }
}

See page 6 of this.

But, why didn't you ask in the PJRC forums? [+edit] Oh, I see that you've already asked this in the Teensy forum and you've already had plenty of help. Why ask in here? If those guys can't help you, you won't get any better help here.

Pete

I asked here as SHT31 has been used by the Arduino platform more and made by adafruit. But thanks, I got it resolved.

K