My ultrasonic sensor is using my conditions as its range

Yes

And when you tried the newping example what did the sensors do?

I found out that the and operator and the && are to deferent types of operators and I was using the binary (bitwise) version. thank you for all your help.

1 Like

They are the same. Both do logical comparisons

Make sure you don’t mistake the boolean AND operator, && (double ampersand) for the bitwise AND operator & (single ampersand). They are entirely different beasts.

The variable candy needed to be float, not long integer.