Unofficial Response to Launcher/hang Program Help

The original post was posted by teeope

For the competition StarStruck, my and my teams launch is a gear system with touchsensors to lift the launch, and then another touchsensor to lower it. We also have a high hang, which is programmed to 2 buttons to lift and lower. Could you tell me if my program will work the way i want it to?


#pragma config(Sensor, dgtl1, touchsensor1, sensorTouch)
#pragma config(Sensor, dgtl2, touchsensor2, sensorTouch)
#pragma config(Motor, port2, wheel1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, lift, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, wheel2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, lift, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, launch1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, launch2, tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{
while(1==1)
{
if(SensorValue(touchsensor1) ==1)
{
motor[port6] = 127;
motor[port7] = 127;

if(SensorValue(touchsensor2) ==1)
{
motor[port6] = -127;
motor[port7] = -127;

motor[port2] = vexRT[Ch3];
motor[port4] = vexRT[Ch2];

if(vexRT[Btn6U] ==1)
{
motor[port5] = 127;
motor[port3] = 127;
}
if(vexRT[Btn6D] ==1)
{
motor[port3] = -127;
motor[port5] = -127;
}
else
{
motor[port3] = 0;
motor[port5] = 0;

}
}
}
}
}

task main() {
while(1==1) {
    //Setting the motors equal to 127 or -127 depending on which touch sensor is pressed
   setMultipleMotors((SensorValue(touchsensor1) -  SensorValue(touchsensor2))*127, port6, port7);

   //Setting drive motors to VexRT channels
   motor[port2] = vexRT[Ch3];
   motor[port4] = vexRT[Ch2];

    //Setting lift motors equal to 127 or -127 depending on which button is pressed
   setMultipleMotors((VexRT[Btn6U] - VexRT[Btn6D])*127, port5, port3);


}
}

More information about how this works can be found here. @Cody channel.

@teeope