Programming Dual Variable If statment

Ok i am planning on making a super fast autonomous robot what has four motors and is geared up for speed.

This will navigate a very tight course that i am going to construct from wood, 2x4’s or plyboard.

I have a problem

In order for this to work the robot is going to have to figure out which way to turn on its own without me programming it verbatim.

So i was thinking that i will have the ultrasonic sensor in the front to tell how far away the next wall is, i will have 2 limit switches on each side that will tell the robot which way to turn.

Heres what i want

If(ultrasonic=5 and Limitswitch1=0)

Motors turn left

And the opposite

If(ultrasonic=5 and Limitswitch2=0)

Motors turn right

Can i do a two variable if statement like this in easy c v2?

Here are the boolean operators for C

x AND y

``````
x && y

``````

x OR Y

``````
x || y

``````

NOT x

``````
!x

``````

Thanks a lot, i will try to program some of this soon.

I just hope the vex can spin fast, i am also going to put optical shaft encoder on this thing.

don’t forget that when checking to see if 2 values are equal, you need to use 2 equal signs:

if (x == 5 && y == 3)

but when you’re assigning a value to a variable, you just use 1:

x = 3;
y = 5;

i just though of something, when posting code like above
but we are actually using easyC, why dont we just take screenshots!?! and then embed the pics