Pages: [1]   Go Down
Author Topic: HELP: Connect TC74 temperature sensor with arduino  (Read 1372 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I started with arduino a few days aago, but and i want to learn more smiley-razz.

I connected an tc74 temperature sensor on arduino, wrote the code, but the programm don't do nothing.

TC74A0:
i think the address is 0x48


CODE:

i saw this code on a toturial that include an i2c device and made some modifications, i made some prints to see where the problem is and the program just print 123

#include "Wire.h"
void setup()
{
Wire.begin(0x4D); // wake up I2C bus  Serial.begin(9600);
Serial.begin(9600);
}
void getCN75data(byte *a)
{
  Serial.print(1);
 // move the register pointer back to the first register
 Wire.beginTransmission(0x4D); // "Hey, CN75 @ 0x48! Message for you"
Serial.print(2);
Wire.send(0);        // "move your register pointer back to 00h"
Serial.print(3);
Wire.endTransmission(); // "Thanks, goodbye..."
// now get the data from the CN75
Serial.print(4);
Wire.requestFrom(0x4D, 1); // "Hey, CN75 @ 0x48 - please send me the contents of your first two registers"
 Serial.print(5);
 *a = Wire.receive(); // first received byte stored here
 Serial.print(6);
}
void showCN75data()
{
   float temperature=0;
byte aa;

 getCN75data(&aa);
if (aa>127) // check for below zero degrees
{
 temperature=((aa-128)*-1);
 }   else // it must be above zero degrees
 {
  temperature=aa;
 }
 
Serial.print("Temperature = ");
Serial.print(temperature,1);
Serial.println(" degrees C");
delay(1000);
}
void loop()
{
 showCN75data();
}


Please help, sorry about my english :S

Thanks in advance
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

it's solved! smiley-razz bad physical connection, and the address on the code were wrong.

thanks anyway
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well solved,

Please if you post code again use the #button to tag the code as code ... looks so much better
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: