Setting motor output based on gyro angle

Hello -

Here’s the logic behind what I want to do. Note that all of this code is within a while loop inside Periodic Tasks.vi. I want to use the rangefinder and gyro to help one of the drivers shoot.

I want to get the distance from the rangefinder, and if it falls between a certain range, make a case structure true. Within this structure, I can then press button 1 on a joystick to make the next case structure true. Within this next case structure, I’m getting the Gyro angle and seeing if it falls within a range of angles. If it’s false, I want to set the motor output of a motor to 0.25 until the angle falls within a range of angles. Download the VI to see what I’ve drafted.

Do you think this will do what I want it to do?

Thanks.

New attempt. I think this one is cleaner and is easier to read. See attached VI.

Test.vi (13.3 KB)


Test.vi (13.3 KB)