Can two TSIC306 sensors be used in the same sketch?

Hello All,

Uno and TSIC306

using the sensor on pin 4

Is it possible to use 2 Tsic306 temperature sensors at a time?

I am using TSIC.h and using the sketch i cannot see how it is possible?

#include "TSIC.h"       // include the library

// instantiate the library, representing the sensor
//TSIC Sensor1(4, 2);    // Signalpin, VCCpin, Sensor Type
TSIC Sensor1(4);    // only Signalpin, VCCpin unused by default


uint16_t temperature = 0;
float Temperatur_C = 0;

void setup() {
    Serial.begin(9600); // set up the serial port
}

void loop() {
  
  if (Sensor1.getTemperature(&temperature)) {
    Serial.print("uint_16: ");
    Serial.println(temperature);
    Temperatur_C = Sensor1.calc_Celsius(&temperature);
    Serial.print("Temperature: ");
    Serial.print(Temperatur_C);
    Serial.println(" °C");
  }
  
  delay(1000);    // wait 1 seconds
}

Surely the library allows you to declare another instance of the sensor, on a different pin. Check the documentation.

TSIC Sensor1(4);    // only Signalpin, VCCpin unused by default

Hello Jremington

You are quite rite i am just having a midweek brain fart, I have now tried the this code and it works. At first i could only get one of the two sensors to give a reading i missed this line "Temperatur_C =SensorSteam.calc_Celsius(&temperature);"
so it kept giving me only sensor 1's readings, after staring at the example i worked it out

 #include "TSIC.h"       // include the library


TSIC Sensor1(4);    // only Signalpin, VCCpin unused by default
TSIC SensorSteam(7);

uint16_t temperature = 0;
float Temperatur_C = 0;

void setup() {
    Serial.begin(9600); // set up the serial port
}

void loop() {
  
(Sensor1.getTemperature(&temperature)); 
    Serial.print("uint_16: ");
    Serial.println(temperature);
    Temperatur_C = Sensor1.calc_Celsius(&temperature);
    Serial.print("Temperature: ");
    Serial.print(Temperatur_C);
    Serial.println(" °C");


     if (SensorSteam.getTemperature(&temperature)); 
    Serial.print("uint_16: ");
    Serial.println(temperature);
    Temperatur_C = SensorSteam.calc_Celsius(&temperature);
    Serial.print("TemperatureSTEAM: ");
    Serial.print(Temperatur_C);
    Serial.println(" °C");
  
  
  delay(1000);    // wait 1 seconds
}

thank you for your help :smiley: