M5Stack+MLX90640 compiler problem with GitHub-sketch

Hello, i want to use the GitHub-Sketch with my M5Stack and the MLX90640 Infrared Sensor, but if i run the compiler i get an error!

In the line 322

if (max_v > max_cam_v | max_v < min_cam_v )

i get this error:

suggest parentheses around comparison in operand of ‘|’ [-Werror=parentheses]

What must i change to solve my problem?

Jürgen

interpolation.cpp (4.38 KB)

M5Stack-MLX90640-Thermal-Camera.ino (13.1 KB)

MLX90640_API.cpp (29.4 KB)

MLX90640_API.h (2.07 KB)

MLX90640_I2C_Driver.cpp (2.97 KB)

MLX90640_I2C_Driver.h (1.54 KB)

Look up | and ||

Mark

Of by the way that's not an error but a warning

Mark

Hello Mark,

what do you mean “Look up | and ||” If the mesage is a warning i can’t nevertheless load the sketch to
my M5Stack!

Jürgen

what do you mean "Look up | and ||"

Just what holmes4 said. | and || are operators. They do similar things but are NOT interchangeable. Learn which one you should be using.

If you use the correct operator, the warning will go away.

If the mesage is a warning i can't nevertheless load the sketch to
my M5Stack!

There must be more messages that you couldn't be bothered showing us. I have more answers, but I can't be bothered showing them, either.

Hello PaulS

There is no other message as i indicate you.

I use Arduino IDE 1.8.4 and i have no great experience with C++
I bought the sonsor and want to use the sketch for a thermal canera

Jürgen

There is no other message as i indicate you.

Did you add the parentheses, as you were supposed to?
Did you use the correct operator, as you were supposed to?

If not, why not?

If you did, it is extremely unlikely that are getting the exact same messages. If you are, post the modified code.

If i add the parentheses, here in this code:

if (max_v > max_cam_v (|) max_v < min_cam_v) {

i get this warning: expected primary-expression before ‘|’ token
i don’t know which operator i must use?

Jürgen

If i add the parentheses, here in this code:

That was NOT the correct place to add the parentheses.

if ((max_v > max_cam_v) | (max_v < min_cam_v))

i don’t know which operator i must use?

Is that a question or a statement? That is the wrong punctuation for a statement, and we don’t know whether you know the correct operator to use, so it was pointless to ask us that question.

Did you look at the reference page for the | operator? What does it do? What is it called?

Did you look at the reference page for the || operator? What does it do? What is it called?

If is VERY apparent, after YOU do some research whether to use the bitwise OR operator or the logical OR operator. You are trying to define the logic behind whether or not to do something.

Hello Paul S.
if that helps you!
Here is a version that runs with the M5Stack Core as well as the M5Stack Fire, The MLX90640 is connected to the software to the Grove Port A and the software runs without problems.

Here is the link to the software: M5Stack/examples/Modules at master · m5stack/M5Stack · GitHub

Select the module MLX90640 and you're off!

Sorry for my bad English is not my native language !!