Advertisement
Erfinator

config_TMP006(sensor1, samples);

Jan 4th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include "TMP006.h"
  2. #include "I2C_16.h"
  3. #include <Wire.h>
  4.  
  5. uint8_t sensor1 = 0x40; // I2C address of TMP006, can be 0x40-0x47
  6. uint16_t samples = TMP006_CFG_8SAMPLE; // # of samples per reading, can be 1/2/4/8/16
  7. void setup()
  8. {
  9. Serial.begin(9600);
  10. Serial.println("TMP006 Example");
  11.  
  12. config_TMP006(sensor1, samples);
  13.  
  14. }
  15. void loop()
  16. {
  17. float object_temp = readObjTempC(sensor1);
  18. Serial.print("Object Temperature: ");
  19. Serial.print(object_temp); Serial.println("*C");
  20.  
  21. float sensor_temp = readDieTempC(sensor1);
  22. Serial.print("Sensor Temperature: ");
  23. Serial.print(sensor_temp); Serial.println("*C");
  24.  
  25. delay(2000); // delay 1 second for every 4 samples per reading
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement