MLX90614 If 102.5<x>105 light up an LED

I am doing a project for my class and have wired and programmed the MLX90614 to display the value, but I want it so that if the value is withing a range of 102.5-106 degrees F it will send out a signal to light up an led. The only problem is I don't know how to program this into the board. I already have the library downloaded and from the research I did i'm supposed to make an IF statement or something.

I already have the library downloaded and from the research I did i'm supposed to make an IF statement or something.

So, what is the problem? An if statement is only marginally more difficult to type (correctly) than an assignment statement.

read this would be a good place to start.

if (mlx.readObjectTempF > 102.5) {

Why does this readObjectTempF not look like the other one in your sketch?

Please use code tags when posting code

digitalWrite(LED, :LOW);

I'm going to guess that the compiler wasn't too keen on that one.

Also all executable statements need to be inside a function.

To be blunt, you'd've saved us all a lot of time if you'd posted the error messages you're seeing

I never saw an error message... the thing I was having trouble with was making my idea actually happen. I don't know how to program it to light up the LED if the temperature were to be in the range of 102.5-105 degrees F (like am I using the right variables and statements)

So are you saying you haven't tried compiling the code yet?

How many more copies of this question am I going to have to delete?

DO NOT CROSS-POST, CROSS-POSTING WASTES TIME.

You can ask someone else to delete them for you - there's a control on every single post on the forum, labelled "Report to moderator".

You can read about how to write "if" statements here.

We highly recommend self-study!

No, what you posted does not make sense. Please go over the if statement material again, to see why.

Here I think this makes sense. I'm not getting any errors when compiled and this was what I came up with for my code after reading up. I'm trying to get it so when the value is >102.5 and <106. it lights up the led on pin 13. Sorry if it's frustrating

 int ledPin = 13;
 (ledPin, OUTPUT);      // sets the digital pin as output



 if (mlx.readObjectTempF() > 102.5 and mlx.readObjectTempF() < 106 ) {digitalWrite(13, HIGH);
 }
else {
  digitalWrite(13, LOW);
}

                // LED connected to digital pin 13





}

DO NOT DELETE EARLIER POSTS!

 (ledPin, OUTPUT);      // sets the digital pin as output

No, it doesn't.

Fixed it up I believe.

#include <Wire.h>
#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
int ledPin = 13;

void setup() {
  Serial.begin(9600);
   pinMode(ledPin, OUTPUT);  // declare LED as output

  Serial.println("Adafruit MLX90614 test");  

  mlx.begin();  
}

void loop() {
  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();
  
 
       



 if (mlx.readObjectTempF() > 102.5 and mlx.readObjectTempF() < 106 ) {digitalWrite(ledPin, HIGH);
 }
else {
  digitalWrite(ledPin, LOW);
}

Welp thanks for the help everyone. I got it to work on my own now with no problem at all.