Hai dudes ,
I wrote a program for my quardcopter but i have some problem in it,The concept of my code is if pin0 detect 5v means it will print “FORW;”.If same pin detect 3.3v means it will print “BACK;”.Again if the same pin detect any other voltge value instead of 5v and 3.3v means it will print “N;”.But i have tried to print “N;”,it is not printing.
Could anybody help me please
sketch_oct02a.ino: In function 'void loop()':
sketch_oct02a.ino:26:18: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
sketch_oct02a.ino:30:18: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
sketch_oct02a.ino:30:34: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
sketch_oct02a.ino:38:18: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
sketch_oct02a.ino:42:18: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
sketch_oct02a.ino:42:34: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
sketch_oct02a.ino:50:19: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
sketch_oct02a.ino:54:18: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
sketch_oct02a.ino:54:34: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
You should not compare float variables with '==',
rounding and limitations in the representation make results very counterintuitive.
Instead if (myFloat == 3.4) use something like if (abs(myFloat-3.4) < 0.001).
(Values 0 and NaN can be compared with ==)
The way you try to test ranges does not work with any type, it does not what you want (see warnings).