Error message for code!

Hi! I just had an issue with this code, could I grab some assistance? The code is below

#include <jm_LiquidCrystal_I2C.h>

#include <Servo.h>
#include <Wire.h>
#include <Adafruit_MiniMLX90614.h>

Adafruit_MiniMLX90614 mlx = Adafruit_MiniMLX90614();
LiquidCrystal_h I2C(0x27, 20, 4);

Servo myservo1;
Servo myservo2;

#define red 13
#define haha 4
int pos1, pos2;

void setup() {
  Serial.begin(9600);
  pinMode(red, OUTPUT);
  pinMode(haha, INPUT);
  myservo1.attach(7);
  myservo2.attach(8);
  myservo1.write(90);
  myservo2.write(90);
  mlx.begin();

  lcd.init();
  lcd.backlight();


}

void loop() {

  int montion = digitalRead(haha);

  if (montion == 1) {

    Serial.print("made");
    Serial.print("\n");
    lcd.setCursor(0, 0);
    lcd.print("ObjectTemp:");
    lcd.setCursor(13, 3);
    lcd.print("-DKARDU");

    kaiguan();
  }
}

void kaiguan() {

  int temp_obj = mlx.readObjectTempC();
  Serial.print(temp_obj);
  Serial.print("\n");
  if (temp_obj < 31) {
    lcd.setCursor(0, 1);
    lcd.print(temp_obj);
    lcd.setCursor(0, 2);
    lcd.print("Not detected,retest!");

  } if (temp_obj > 30 && temp_obj < 38) {

    lcd.setCursor(0, 1);
    lcd.print(temp_obj);
    lcd.setCursor(0, 2);
    lcd.print("body temperature ok ");
    for (pos1 = 90; pos1 <= 180; pos1 += 1)
    {
      myservo1.write(pos1);
      myservo2.write(180 - pos1);
      delay(15);
    }
    delay(5000);

    for (pos1 = 180; pos1 >= 90; pos1 -= 1)
    {
      myservo1.write(pos1);
      myservo2.write(180 - pos1);
      delay(15);
    }

  }
  if (temp_obj > 37) {
    digitalWrite(red, HIGH);
    lcd.setCursor(0, 1);
    lcd.print(temp_obj);
    lcd.setCursor(0, 2);
    lcd.print("     Keep out!       ");
    delay(500);

  }
  digitalWrite(red, LOW);
}

I got the error message:

'Error compiling for board Arduino Uno.'
How may I fix this?

First of all, THANK YOU for using code tags and for posting all of your code, and in your first post!

The Arduino IDE should tell you how to get more details. Do it, and compile again. This time, copy the entire error message and post it here as if you were posting code (paste and use code tags).

It looks like the Adafruit_MiniMLX90614 library was not properly installed.
And the jm_Scheduler library not installed.
And the jm_Wire library not installed.

That's when I got tired of finding libraries.

Install the hd44780 library. Then you will not need any of the jm_ libraries. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

That should take care of the I2C LCD. You still need to find and install the Adafruit_MiniMLX90614 library.

vaj4088:
First of all, THANK YOU for using code tags and for posting all of your code, and in your first post!

The Arduino IDE should tell you how to get more details. Do it, and compile again. This time, copy the entire error message and post it here as if you were posting code (paste and use code tags).

Alright, here is the entire error message.

Arduino: 1.8.13 (Windows 7), Board: "Arduino Uno"





















C:\Users\Rakesh.Mehta\Documents\Arduino\libraries\jm_LiquidCrystal_I2C\fm_I2CIO.cpp:29:10: fatal error: jm_Scheduler.h: No such file or directory

 #include <jm_Scheduler.h>

          ^~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

Error compiling for board Arduino Uno.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I found out that the Adafruit_MiniMLX90614 library is not the right library for an Uno.
Form the reference for the Adafruit_MiniMLX90614 library:

NOT FOR REGULAR ARDUINOS! Use the regular Adafruit_MLX90614 for that

Install the Adafruit_MLX90614 library.

Here is your code with the hd44780 library and the proper Adafruit-MLX90614 library. This code compiles with one warning.

#include <Servo.h>
#include <Wire.h>
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
#include <Adafruit_MLX90614.h>

Adafruit_MLX90614 mlx = Adafruit_MLX90614();
hd44780_I2Cexp lcd; 

Servo myservo1;
Servo myservo2;

#define red 13
#define haha 4
int pos1, pos2;

const int LCD_COLS = 16;
const int LCD_ROWS = 2;

void setup()
{
   Serial.begin(9600);
   pinMode(red, OUTPUT);
   pinMode(haha, INPUT);
   myservo1.attach(7);
   myservo2.attach(8);
   myservo1.write(90);
   myservo2.write(90);
   mlx.begin();

   lcd.begin(LCD_COLS, LCD_ROWS);
   lcd.backlight();
}

void loop()
{

   int montion = digitalRead(haha);

   if (montion == 1)
   {

      Serial.print("made");
      Serial.print("\n");
      lcd.setCursor(0, 0);
      lcd.print("ObjectTemp:");
      lcd.setCursor(13, 3);
      lcd.print("-DKARDU");

      kaiguan();
   }
}

void kaiguan()
{

   int temp_obj = mlx.readObjectTempC();
   Serial.print(temp_obj);
   Serial.print("\n");
   if (temp_obj < 31)
   {
      lcd.setCursor(0, 1);
      lcd.print(temp_obj);
      lcd.setCursor(0, 2);
      lcd.print("Not detected,retest!");

   } if (temp_obj > 30 && temp_obj < 38)
   {

      lcd.setCursor(0, 1);
      lcd.print(temp_obj);
      lcd.setCursor(0, 2);
      lcd.print("body temperature ok ");
      for (pos1 = 90; pos1 <= 180; pos1 += 1)
      {
         myservo1.write(pos1);
         myservo2.write(180 - pos1);
         delay(15);
      }
      delay(5000);

      for (pos1 = 180; pos1 >= 90; pos1 -= 1)
      {
         myservo1.write(pos1);
         myservo2.write(180 - pos1);
         delay(15);
      }

   }
   if (temp_obj > 37)
   {
      digitalWrite(red, HIGH);
      lcd.setCursor(0, 1);
      lcd.print(temp_obj);
      lcd.setCursor(0, 2);
      lcd.print("     Keep out!       ");
      delay(500);

   }
   digitalWrite(red, LOW);
}

You will see more error messages if you enable compile warnings in IDE, File, Preferences.

Okay thank you so much for your help. I'll test it out and see how it goes and I'll read the guidelines as well

I missed the LCD configuration.

I had

const int LCD_COLS = 16;
const int LCD_ROWS = 2;

It should be:

const int LCD_COLS = 20;
const int LCD_ROWS = 4;

Yesss the code worked, thank you so much. It's suppose to open a door automatically by checking a persons temperature using a sensor, it will display it on a LCD, will this code work? It's a project i'm working on!

Okay i'll change it, and also it's just a cardboard door :slight_smile: