CCCPaste

Temperature Monitor rev_13

/********* 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 Monitor
	- Source Code compiled for: Arduino Uno
	- Source Code created on: 2023-12-19 10:50:09

********* Pleasedontcode.com **********/

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
	/* read temperature and show on serial. */
/****** END SYSTEM REQUIREMENTS *****/


/********* User code review feedback **********
#### Feedback 1 ####
- rework code only showing Fahrenheit temperature and not the rest
.
********* User code review feedback **********/

/****** DEFINITION OF LIBRARIES *****/
#include 
#include 
#include 

/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* read temperature and show on serial. */
/****** END SYSTEM REQUIREMENTS *****/

/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);

/***** DEFINITION OF I2C PINS *****/
const uint8_t I2C_PIN_SDA = A4;
const uint8_t I2C_PIN_SCL = A5;
const uint8_t I2C_SLAVE_ADDRESS = 0x5A;

/****** DEFINITION OF LIBRARY CLASS INSTANCES*****/
Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup(void)
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  while (!Serial);

  Serial.println("Adafruit MLX90614 test");

  Wire.begin(); // Remove the arguments from the Wire.begin() function call
  
  if (!mlx.begin(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:
  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();
  delay(500);
}