Welcome, Guest

Author Topic: TMP006 Temperature Sensor  (Read 3276 times)

walk_porto

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
TMP006 Temperature Sensor
« on: July 08, 2016, 07:49:43 PM »
Hello,

I've got a problem with a TMP006 Temperature Sensor. I am working on Windows 10, x4-easy-rev999 IDE and with a PIC32MX440F256H.
I think I did the right connections between the sensor and the Pinguino card, I took example on it : https://learn.sparkfun.com/tutorials/tmp...okup-guide. So for me, VCC sensor on 5V card, GND on GND, SDA sensor on A4 and SCL sensor on A5.

I would like to get back the data of this sensor but I can't compile the program.

I downloaded all the files necessary with this link : https://github.com/adafruit/Adafruit_TMP006
I put all the files in the same directory : D:\Stage_Technique\x4-easy-rev999\.temp

So, my main program is the following :

#include <stdint.h>
#include <math.h>
#include <Wire.h>
#include <I2C_16.h>
#include <TMP006.h>

uint8_t sensor1 = 0x40; // I2C address of TMP006, can be 0x40-0x47
uint16_t samples = TMP006_CFG_1SAMPLE; // # of samples per reading, can be 1/2/4/8/16

void setup() {
  Serial.begin(9600);
  Serial.println("TMP006 Example");

  config_TMP006(sensor1, samples);
}

void loop()
{
  float object_temp = readObjTempC(sensor1);
  Serial.print("Object Temperature: ");
  Serial.print(object_temp); Serial.println("*C");

  float sensor_temp = readDieTempC(sensor1);
  Serial.print("Sensor Temperature: ");
  Serial.print(sensor_temp); Serial.println("*C");

  delay(1000); // delay 1 second for every 4 samples per reading
}

When I compile, I've got this error : D:\Stage_Technique\x4-easy-rev999\.temp/Print.h:23:21: fatal error: WString.h: No such file or directory
And then, I downloaded WString.h and I put it in the same directory as the other ones.
But I have the same error each time because I had to download the missing file.
Someone has the solution ? Have I to download all the files until the end, if there is an end ?
I am using Arduino code I know..
I also posted this post there : http://forum.pinguino.cc/showthread.php?tid=4862&pid=12248#pid12248
« Last Edit: July 08, 2016, 07:52:29 PM by walk_porto »

JohnS

  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +33/-45
Re: TMP006 Temperature Sensor
« Reply #1 on: July 08, 2016, 08:51:33 PM »
You have to convert C++ to C.

John

walk_porto

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: TMP006 Temperature Sensor
« Reply #2 on: July 09, 2016, 01:42:20 PM »
Only for the main program (the one I posted above) ?

JohnS

  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +33/-45
Re: TMP006 Temperature Sensor
« Reply #3 on: July 09, 2016, 02:36:42 PM »
All C++

John

walk_porto

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: TMP006 Temperature Sensor
« Reply #4 on: July 09, 2016, 02:48:27 PM »
It will be too long, I don't have enough time to do that, I should try with an Arduino instead of a Pinguino I think.