MLX90614 Arduino Sensor Code
0:52
Cpp
#include #include #include // Configuración de la pantalla LCD: dirección I2C, 16 columnas y 2 filas. // La dirección I2C común es 0x27, aunque podría ser 0x3F según el módulo. LiquidCrystal_I2C lcd(0x27, 16, 2); Adafruit_MLX90614 mlx = Adafruit_MLX90614(); void setup() { Serial.begin(9600); // Inicializar pantalla LCD lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("Inicializando..."); // Inicializar sensor MLX90614 if (!mlx.begin()) { Serial.println("Error al iniciar MLX90614!"); lcd.clear(); lcd.setCursor(0, 0); lcd.print("Error MLX90614"); while (true); // Detener ejecución si falla la inicialización } delay(1000); lcd.clear(); } void loop() { // Leer las temperaturas: ambiente y objeto (disco de freno) float tempAmbiente = mlx.readAmbientTempC(); float tempObjeto = mlx.readObjectTempC(); // Mostrar en el monitor serial Serial.print("Temp Amb: "); Serial.print(tempAmbiente); Serial.print(" C\tTemp Obj: "); Serial.print(tempObjeto); Serial.println(" C"); // Actualizar la pantalla LCD lcd.setCursor(0, 0); lcd.print("Amb: "); lcd.print(tempAmbiente, 1); lcd.print("C "); lcd.setCursor(0, 1); lcd.print("Obj: "); lcd.print(tempObjeto, 1); lcd.print("C "); delay(500); }
Ready.
Reviews
Properties
Properties describe core aspects of the project.
Pricing & Availability
Distributor | Qty 1 |
|---|
Assets
No assets added.
Controls
Welcome 👋
Flux helps you build PCBs faster with an AI teammate!
Create your account to collaborate, stay updated, fork your own version, and get instant answers from our AI agent.