|
Re: servo
A While Loop in Teleop set to run once with nothing passed in or out has no real purpose. I would remove it for ease of reading.
Your servo code creates a race condition. You are setting the value two separate times with two separate pieces of code. Where the servo will end up is not determinate and may not be consistent. I have shown one way of wiring the up and down commands using a single Servo Set VI. You should be able to follow that example to fix the left-right servo code.
I have included an example of controlling a motor with a joystick y-axis, a button that runs it one direction and two buttons that run it in opposite directions.
The PWM channels are specified when you open the device in Begin.VI. I have included an example of how to open a motor and set the refnum in the attached teleop file but this is NOT where that code should go in your project. It must be done in Begin.
Sync groups are an advanced function used with CAN that you don't need to worry about right now. You want to be wiring into the terminal labeled "output" on the Motor Set Output VI.
If you have any other questions or are having difficulty understanding any of the examples please feel free to ask.
__________________
2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
Last edited by Vikesrock : 16-02-2011 at 19:48.
|