Code Check

Our teams goal is to use 2 window motors to drive the first segment of our arm and one as yet undefined motor to drive the second part (the farther out part). Attached is the code that I believe will do this. I will check it tomorrow but if there is something blatantly wrong I would like to have it solved by tomorrow morning so I don’t waste much-needed time.

On the example the open and close blocks are together in the sequence structure. In the code they are closed in the proper place in the FRC framework.

We are using potentiometers, we have yet to find the correct voltage for the correct positions so I just put zeros there for now. This is just one example the actual robot code is on the last 3 attachments. Thank You for any and all Help! (24.5 KB) (14.5 KB) (27.8 KB) (15.1 KB) (24.5 KB) (14.5 KB) (27.8 KB) (15.1 KB)

There are a few things I notice.

  • Generally, you should be defining refnums in the portion of the code.

  • There should be no need to use close vi’s on the motors or analog stuff.

  • It appears in that all the motors have the same PWM channel. This means only one motor. Set only one to PWM 1, others to 2,3, etc.

  • It is unclear to me why you are taking voltage info and from where, but since I do not know exactly how your bot works, just let it be.

My team’s bot works similarly but with only two motors: one stationary, and one moving up and down while moving another part of our arm.

These were not big things that would be hard to find, but I hope it helps!

That does help quite a bit. So do I need to open and define in If so, how do I say “motor 1 is actually referenced as ‘window 1’”?

Sorry, I know the PWMs are supposed to be different numbers for the motors, I justy have not yet done that. Thanks, though.

We are taking voltage readings from a pot to position the arm.

So the basic syntax will be right if i move the refnum, is the PID correct? As in, will it move window 1 and window 2 to position x when button y is pressed?