# 6 Bar Code Help

So I have a 6 bar lift with 4 motors and looking if someone can help me code. So I’m usually the builder for my team and I don’t really know coding. Anyone know how to do this. I tried if statements and else but it doesn’t work. Thanks

What have you already tried? If statements are what you use to create it.

What you do is have a condition checking for if a button is pushed, and have a response based on that. The conditions would be inside a while loop.

``````
if (vexRT[Btn6U] == 1)
{
motor[fourLeft] = 127;
motor[fourRight] = 127;
motor[sixLeft] = 127;
motor[sixRight] = 127;
}

else if (vexRT[Btn6D] == 1)
{
motor[fourLeft] = -127;
motor[fourRight] = -127;
motor[sixLeft] = -127;
motor[sixRight] = -127;
}

else
{
motor[fourLeft] = 0;
motor[fourRight] = 0;
motor[sixLeft] = 0;
motor[sixRight] = 0;
}

``````

So wondering what ports do you think it should go in. And a while loop is this right

``````#pragma config(Motor,  port1,           fourLeft,      tmotorVex393_HBridge, openLoop)
#pragma config(Motor,  port2,           fourRight,     tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port3,           sixLeft,       tmotorVex393_MC29, openLoop)
#pragma config(Motor,  port4,           sixRight,      tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

{
while(true)
if (vexRT[Btn6U] == 1)
{
motor[fourLeft] = 127;
motor[fourRight] = 127;
motor[sixLeft] = 127;
motor[sixRight] = 127;
}

else if (vexRT[Btn6D] == 1)
{
motor[fourLeft] = -127;
motor[fourRight] = -127;
motor[sixLeft] = -127;
motor[sixRight] = -127;
}

else
{
motor[fourLeft] = 0;
motor[fourRight] = 0;
motor[sixLeft] = 0;
motor[sixRight] = 0;
}

}
``````

You forgot the set braces for the while loop

So where to place it new to coding learning still