sparkfun / SparkFun_MLX90640_Arduino_Example

Controlling and reading from the MLX90640 IR array thermal imaging sensor
https://www.sparkfun.com/
Other
122 stars 35 forks source link

Reading all temperature values from 768 pixels simultaneously and checking the numbers #20

Closed h-Naima-s closed 4 years ago

h-Naima-s commented 4 years ago

What I am trying to do is, read temperature value from each pixel and if temperature value from any of the 768 pixel is above 27 (even if one pixel is above 27) turn LED on, otherwise keep it off. For this i have edited the code starting from line 72 as follows: ` for (int x = 0 ; x < 768 ; x++) //NEW { Serial.print("Pixel "); Serial.print(x); Serial.print(": "); Serial.print(mlx90640To[x], 2); Serial.print("C"); Serial.println();

if(mlx90640To[x<768]>=27) //NEW
   digitalWrite(ledPin, HIGH);     //NEW
if(mlx90640To[x<768]<27) //NEW
   digitalWrite(ledPin, LOW);     //NEW

} `

But this code is not keeping LED on though i am getting many values above 27 degree C on serial monitor. It turns LED on only when temperature gets above 30C and not otherwise. Please help with what is wrong here? and what is better logic. How to make the code to check for all x between 0 to 768, if anything is above 27 C?