-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempsensor.ino
More file actions
38 lines (36 loc) · 1.45 KB
/
tempsensor.ino
File metadata and controls
38 lines (36 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/***************************************************
This is a library example for the MLX90614 Temp Sensor
Designed specifically to work with the MLX90614 sensors in the
adafruit shop
----> https://www.adafruit.com/products/1748
----> https://www.adafruit.com/products/1749
These sensors use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() {
Serial.begin(115200);
// Serial.println("Adafruit MLX90614 test");
mlx.begin();
}
void loop() {
// Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempC());
// Serial.print("*C\tObject = ");
// Serial.print(mlx.readObjectTempC());
// Serial.println("*C");
// Serial.print("Ambient = "); Serial.print(mlx.readAmbientTempF());
// Serial.print("*F\tObject = "); Serial.print(mlx.readObjectTempF()); Serial.println("*F");
// Serial.println();
// Serial.write(Serial.print(mlx.readObjectTempC()));
// Serial.write(Serial.println());
while(!Serial && (millis()<30000));
delay(1000);
Serial.println(mlx.readObjectTempC());
}