I would like to connect 2 tc74 temperature sensors to the arduino and have searched high and low with no luck finding examples. I am using the microchip TC74A1. THe code below was found on the internet, author unknown. It works with one sensor.
I have used the I2C buss to connect the 1st sensor. How would I add a 2nd sensor. I would like to measure outside/ inside temp. I am unfamiliar how to address multiple sensors on the buss. Here is my code for the 1st sensor.
Code: Select all
#include "Wire.h"
//wire library
// I assume this is the register address there the temp info is stored per the data sheet.
#define address 0x49
#define delayC 1000
//delay count in ms
#define baudrate 9600
//baudrate for communication
byte val = 0;
void setup()
{
Wire.begin();
Serial.begin(baudrate);
}
void loop()
{
Serial.print("temperature in Celsius: ");
//let's signal we're about to do something
int temperature;
//temperature in a byte
Wire.beginTransmission(address);
//start the transmission
Wire.write(val);
Wire.requestFrom(address, 1);
if (Wire.available()) {
temperature = Wire.read();
Serial.println(temperature);
}
else {
Serial.println("---");
}
delay(1000);
}
Scott