![]() |
How to Program a Servo
Hello - Im the head programmer/electronics guy at LF Robotics. I am the only one of my kind on the team and this is my first year so I have absolutely NO experience so PLEASE bear with me.
I want to have a servo that by the touch of say button four on the joystick will rotate 45 degrees to the right and once it reaches that point will return to its original position. I am using Command Based Java in Netbeans. I know how to do simple things with it - like I said this is my first year. ANY help will be GREATLY appreciated - THANKS! |
Re: How to Program a Servo
Hello again! I would recommend asking all your questions in one thread please. It makes the life of people who are trying to help you much easier xD
|
Re: How to Program a Servo
If you can use robot builder to create your subsystem and commands. Robot builder is create for beginners. Always make sure to review the code it generates and try to understand what it is doing.
The basic approach (no code. I'm a C++ guru and am not confident I would not provide broken java code.). Create a subsystem and add a Servo to it or add a Servo object to an appropriate existing subsystem. Solution A Create a command that moves the servo to position 1. Create a command that moves the servo to position 2. Create a command group that adds sequentially: --MoveServoToPos1Command --WaitCommand(timeItTakesForServoToRotate45Deg) --MoveServoToPos2Command Assign command group to a joystick button. Solution B Create a command that moves the servo to position 1 and then waits the timeItTakesForServoToRotate45Deg and then moves the servo to position 2. The choice is up to you how much you want to break the problem down. 1 command will work but a command group of discrete commands would be more flexible. |
Re: How to Program a Servo
Okay - THANKS - I think I got it figured out now.
|
| All times are GMT -5. The time now is 02:35. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi