1. 2 months ago

    I am trying to code something for the turning point competition. Using a motor encoder i want to be able to press a button and have our lift extend to a specific point for easy scoring. I figured out how to make a motor rotate a certain amount and then stop, but still haven't figured out how to map it to a button.

  2. jpearman

    Oct 10 Moderator, ROBOTC Tech Support, V5 Beta Moderator Los Angeles 8888

    You need to detect the button press in this way.

      if( vexRT[Btn5D] == 1 ) {
          // start motor
      
          // wait for motor to reach the encoder value
      
          // stop motor
    
          // optionally, wait for button release here
          while( vexRT[Btn5D] == 1 ) {
             wait1Msec(10); 
          }
      }
 

or Sign Up to reply!