
Noob PLTW teacher with programming question
Let me apologize immediately if I placed this is the wrong forum. I didn't intend to.
I am a new PLTW teacher, and we do not have the VEX in the curriculum yet. However, I am involved in a robot competition, and I need to help with programming a space elevator winch.
I want to have the winch climb with the following commands and then brake. If I delete the else statement, the buttons work as described, although the motor is on until I give a different command. I would like the motor to stop when no command is given. Later, I might have to add a percent of motor to compensate for added weight and free fall.
When I give a 0 or a 10 in the else statement, the motor chudders during any of the other commands. I realize this is a simple issue to many of you, but if you could help me with my limited knowledge, I would greatly appreciate it.
#pragma config(Motor, port2, winch, tmotorVex393, openLoop)
#pragma config(Motor, port3, rotatearm, tmotorVex269, openLoop)
#pragma config(Motor, port4, armextend, tmotorVex269, openLoop)
#pragma config(Motor, port5, claw, tmotorServoStandard, openLoop)
#pragma config(Motor, port6, clawtilt, tmotorServoStandard, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
while (1==1)
{
{
if (vexRT[Btn5U]==1) // button 5U pressed
motor[winch]=127; // climb high speed
if (vexRT[Btn5D]==1) // button 5D pressed
motor[winch]=-40; // decend high speed
if (vexRT[Btn7U]==1) // button 7U pressed
motor[winch]=63; // climb low speed
if (vexRT[Btn7D]==1) // button 7D pressed
motor[winch]=-10; // decend low speed
else (motor[winch]=0);} // this turns the motor off
{motor[armextend]=vexRT[Ch3]/3;} //extends/retracts arm using joystick
{if (vexRT[Btn6U]==1) //button 6U pressed
motor[claw]=127; //claw clamp
if (vexRT[Btn6D]==1) //button 6D pressed
motor[claw]=-127;} //claw unclamp
{if (vexRT[Btn8U]==1) //button 8U pressed
motor[clawtilt]=127; //claw tiltup
if (vexRT(Btn8D)==1) //button 8D pressed
motor[clawtilt]=-127;} //claw tiltdown
}
}