/********* 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: Sensor Integration
- Source Code compiled for: Arduino Uno
- Source Code created on: 2024-03-06 07:49:53
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* turn on the led when it work */
/****** SYSTEM REQUIREMENT 2 *****/
/* i want the alarm get activated when the gaz sensor */
/* in on */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include //https://github.com/adafruit/Adafruit-MLX90614-Library
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF DIGITAL INPUT PINS *****/
const uint8_t gaz_PIN_D2 = 2;
const uint8_t led_PIN_D13 = 13;
/***** 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();
void setup(void)
{
// put your setup code here, to run once:
pinMode(gaz_PIN_D2, INPUT);
pinMode(led_PIN_D13, OUTPUT);
Serial.begin(9600);
while (!Serial)
;
Serial.println("Adafruit MLX90614 test");
if (!mlx.begin())
{
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:
// Check if the gas sensor is on
if (digitalRead(gaz_PIN_D2) == HIGH)
{
// Activate the alarm
digitalWrite(led_PIN_D13, HIGH);
}
else
{
// Turn off the alarm
digitalWrite(led_PIN_D13, LOW);
}
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);
}