|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
So my team and I were trying to figure out how to program a servo motor in teleop where when we push button 1 the servo spins its full range then once the button is released the servo returns to 0° automatically. No clue how to program this and any help given would be great
|
|
#2
|
|||
|
|||
|
Re: Servo motor?
Quote:
|
|
#3
|
|||||
|
|||||
|
Re: Servo motor?
Assuming you don't care about slowing down the servo's motion, what you want to do is pretty easy. Use a joystick button to select between 0 (when false) and 180 (when true), and feed the selected value to a Gyro Set Angle.
I think the default maximum is actually only 170 degrees. You can change it to match the servo you're using when you Open it. |
|
#4
|
|||
|
|||
|
Re: Servo motor?
We don't care about speed, and we're just trying to get the servo to go from button not pushed: 0°; button pushed 180°, 170 if this is max.
Below is the code we have so far, it's from an example I believe. |
|
#5
|
||||
|
||||
|
Re: Servo motor?
The code looks good to me. Another thing to remember is that the servo needs power applied to it, too. There has to be a jumper across the two pins directly next to the PWM port the servo is plugged into.
|
|
#6
|
|||
|
|||
|
Re: Servo motor?
Quote:
|
|
#7
|
||||
|
||||
|
Re: Servo motor?
Well.. That opens up a whole 'nother bag of worms. Based on what you have said from your last thread, have you tried swapping the cable from the cRIO to the digital sidecar with a known working one? Remember that last year's ribbon cables shipped assembled backwards, which would screw up a bunch of things.
|
|
#8
|
|||
|
|||
|
Re: Servo motor?
Quote:
|
|
#9
|
||||
|
||||
|
Re: Servo motor?
I saw the other thread, and I can't believe I made the fundamental mistake of not suggesting power to the Digital Sidecar. Hopefully applying power will fix everything easily.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|