I am attempting to utilize the rotation sensor to pull down the catapult to its primed position automatically. The code works as intended when I start the program with the catapult, not in its primed position. However, if I start the code with the catapult in its primed position, it does not stop. I have both attached a video of the phenomenon happening and attached pictures of my code to this post.
- You may want to change your order of concerns.
- I’m not sure how you are utilizing the rotation sensor unless you have more code elsewhere.
- You may want to look into placing this in a separate task so it doesn’t interfere with other robot actions.
//Always run the motor if controller button is pressed
if(Controller1.ButtonX.pressing()){
catapultMotors.move_voltage(voltage:12000);
} else
//If the sensor is pressed then stop the motor
if(IsDigitalR1Pressed){
catapultMotors.move_voltage(voltage:0);
} else
//Run the motor until the sensor is pressed.
{
catapultMotors.move_voltage(voltage:12000);
}
2 Likes
We figured out that the rotational sensor was actually going rather than the absolute zero position. This caused the rotational sensor to read a 3600 for a split second causing the catapult to not stop. Thank you for your time and consideration.
1 Like