IME in a teleop program

I am new to using the IME, I pretty much figured out how to use is autonomously. My question is how could I press a button on the joystick, lets say 6U, and have it run the motors? Would it be a similar setup? And my launcher spins for about 10 seconds, and then it stops. The IME’s blink green, so would the motors stopping be caused by too much friction?

This is what I do for autonomous, is it correct for PID control?:
task main()
{
nMotorEncoder[leftlauncher] = 0;
nMotorEncoder[rightlauncher] = 0;
while(nMotorEncoder[rightlauncher] < 18000)
{
motor[leftlauncher] = 73;
motor[rightlauncher] = 73;
}
}

I am a rookie team, thanks for the help in advance.

Sorry, missed this for some reason.

There’s more than one question here. The IME by itself allows you to determine how many rotations the motor has made, if that is all you care about then you can use the nMotorEncoder intrinsic anywhere you like in both autonomous and driver control.

You can use a button to run the motors

while(1)
  {
  if( vexRT Btn6U ] == 1 )
    {
    motor[leftlauncher] = 73;
    motor[rightlauncher] = 73;
    // wait for release
    while(vexRT Btn6U ] == 1)
      wait1Msec(10);
    }
    
  wait1Msec(25);
  }

If your launcher motors stop after 10 seconds using the code you posted, I suspect that you have reached the 18000 count on the encoder and the main task then exits. I’m not really sure what the purpose of running the motors until they reach 18000 counts is.

PID is a completely separate topic. To use the internal PID that ROBOTC provides all you need to do is turn it on in the motors&sensors setup dialog (and perhaps tune the PID constants). See this thread for some more information on that.
https://vexforum.com/t/robotc-has-pid-to-control-your-flywheel/31108/1