Ran into problems with this very specific case. First I switched from float to int * 100. I measure small voltage changes.
Some Values of "Volt" are negative, some positive. This instruction only triggers if "Volt" is positive.
int Volt= 0;
Volt=(int)analogRead(PIN_TEST)REF_VOLTAGE/PIN_STEPS100; // Read new Value
if (Volt > -3 && Volt <= 8 ){
display.println("Switch 1");
}
So my question:
How can I make the Arduino trigger my <> statement for both, positive and negative values?
OT
Btw. The comparison of floats was even weirder. I had to use this (wrong!) <> statements to make it work correctly:
if (Volt < -0.03 && Volt >= 0.08){
display.println("Switch 1");
}
Smaller in my sense means that the value of "Volt" is f.e. -0.04. But here it only seems to take the absolute value (0.03) in account, neglecting the minus.
Also, >= 0.008 is obviously wrong, because I want to catch all the values between -0.03 and 0.08. But that is no my problem for now, since I switched all values to integer now.