/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: "Temperature Reader"
- Source Code compiled for: Arduino Uno
- Source Code created on: 2024-03-06 07:09:39
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* turn on the led when it work */
/****** END SYSTEM REQUIREMENTS *****/
/********* User code review feedback **********
#### Feedback 1 ####
- line 26 doesn't work
********* User code review feedback **********/
/****** DEFINITION OF LIBRARIES *****/
#include
#include
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF I2C PINS *****/
const uint8_t but_GY_906_I2C_PIN_SDA_A4 = A4;
const uint8_t but_GY_906_I2C_PIN_SCL_A5 = A5;
const uint8_t but_GY_906_I2C_SLAVE_ADDRESS = 90;
/****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
const uint8_t ledPin = 13;
void setup(void)
{
// put your setup code here, to run once:
pinMode(ledPin, OUTPUT); // Set the LED pin as output
Serial.begin(9600);
while (!Serial);
Serial.println("Adafruit MLX90614 test");
Wire.begin();
if (!mlx.begin(but_GY_906_I2C_SLAVE_ADDRESS)) {
Serial.println("Error connecting to MLX sensor. Check wiring.");
while (1);
}
Serial.print("Emissivity = "); Serial.println(mlx.readEmissivity());
Serial.println("================================================");
}
void loop(void)
{
// put your main code here, to run repeatedly:
digitalWrite(ledPin, HIGH); // Turn on the LED
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");
digitalWrite(ledPin, LOW); // Turn off the LED
Serial.println();
delay(500);
}