Go Down

Topic: HELP: Connect TC74 temperature sensor with arduino (Read 1 time) previous topic - next topic

pf1991

Hello,

I started with arduino a few days aago, but and i want to learn more :P.

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

pf1991

it's solved! :P bad physical connection, and the address on the code were wrong.

thanks anyway

robtillaart

Well solved,

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

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy