system
July 18, 2012, 5:50pm
1
Hi,
the following statement doesn't seem to work for me:
if (MotorDisable == false && (drive=='L' || drive=='R') && encRight < waytogo)
I just want to know if my syntax is wrong or something in the rest of my sketch's logic.
I want:
MotorDisable to be false
drive to be L or R
encRgight smaler than waytogo
Thanks
Robert
system
July 18, 2012, 5:52pm
2
Try adding more brackets:
if ( (MotorDisable == false) && ((drive=='L') || (drive=='R')) && (encRight < waytogo) )
system
July 18, 2012, 6:18pm
3
Post your code - maybe you've got a misplaced semicolon.
system
July 18, 2012, 6:20pm
4
Thanks majenko,
this doesn't work either. Tomorrow I'll check if it's the statement of if the worblem lies somewhere else.
Thanks
Robert
system
July 18, 2012, 6:46pm
5
or you could just post your code
try adding serial prints of the data before the compare, see if your conditions actually exist.
system
July 19, 2012, 10:48am
7
It worked with the extra brackets. But the error was erlier in the code. With the extrad Serial.prints it showed that I never reached this statement.
Thanks for the help.