![]() |
Servo Help
Hello,
My team is trying to program a servo so when you press a joystick button it goes to a certain angle. I looked and the wpilib page and I saw the "exampleServo.set(0.5);" example code, but I'm not sure how to use a joystick button with that. I have tried various ways, but nothing has worked. Can anyone help me? We are using a servo from ServoCity that turns 90°. It's plugged into a pwm port on the roboRio. |
Re: Servo Help
Try adding the following code to your Robot.java file in the robotInit() method (change the value of PWM_SERVO to match the PWM port you used for your servo):
Code:
Next, in your code where you handle the button press, use the servo "set" method with the value determined from test mode to make the servo go to the proper position. Something like the following: Code:
servo.set(VALUE_FROM_TEST_MODE); |
Re: Servo Help
Quote:
|
Re: Servo Help
The part number is spg5685a-4507a90 and it is changing the position of our shooter
|
| All times are GMT -5. The time now is 08:59 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi