Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Rotating Servo HS322 over 90 degrees (http://www.chiefdelphi.com/forums/showthread.php?t=53865)

brennerator 10-02-2007 19:45

Rotating Servo HS322 over 90 degrees
 
Basically I have this servo and I want to rotate it along its entire range of motion. I have the default code, and I set pwm 11 for this servo.

if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if (p1_sw_top == 1)
{
pwm11 = 0;

This is so that we can upshift and downshift....

Thanks.

JBotAlan 10-02-2007 20:23

Re: Rotating Servo HS322 over 90 degrees
 
Quote:

Originally Posted by brennerator (Post 575643)
Basically I have this servo and I want to rotate it along its entire range of motion. I have the default code, and I set pwm 11 for this servo.

if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if (p1_sw_top == 1)
{
pwm11 = 0;

This is so that we can upshift and downshift....

Thanks.

Ummm...was there a question in there? I can't find one...:o

JBot

brennerator 10-02-2007 20:39

Re: Rotating Servo HS322 over 90 degrees
 
The code in the post does not work. Any help?

fimmel 10-02-2007 20:43

Re: Rotating Servo HS322 over 90 degrees
 
you have 2 if statements you need an else statement

here is an example:
Code:

if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if else (p1_sw_top == 1)
{
pwm11 = 0;
}
else {
}

hope that works.....im sorta new to programming

/forest

chris31 10-02-2007 20:56

Re: Rotating Servo HS322 over 90 degrees
 
Quote:

Originally Posted by fimmel (Post 575696)
you have 2 if statements you need an else statement

here is an example:
Code:

if (p1_sw_trig ==1)
{
pwm11 = 255;
}
if else (p1_sw_top == 1)
{
pwm11 = 0;
}
else {
}

hope that works.....im sorta new to programming

/forest

It should be an "else if" not "if else". Also the last "else" doesnt need to be there as you arent using it for anything.

Alan Anderson 10-02-2007 21:09

Re: Rotating Servo HS322 over 90 degrees
 
Quote:

Originally Posted by brennerator (Post 575694)
The code in the post does not work. Any help?

What do you want it to do? What does it do instead?

Is another part of the code setting pwm11 to something else later?

fimmel 10-02-2007 21:49

Re: Rotating Servo HS322 over 90 degrees
 
Quote:

Originally Posted by chris31 (Post 575709)
It should be an "else if" not "if else". Also the last "else" doesnt need to be there as you arent using it for anything.

thanks....im still learning as well

/forest

brennerator 10-02-2007 22:58

Re: Rotating Servo HS322 over 90 degrees
 
I dont really know what happens; the servo does not move!! do I have t odefine pwm11 just like the default code did for 13-16?

Can anyone shed some light?

Im just using the stock default code and added in the code from post #1

NOV8R 10-02-2007 23:06

Re: Rotating Servo HS322 over 90 degrees
 
To get the Hitec HS322HD servos to rotate more than 90 degress takes a hardware modification of the servo. It's not a software issue. Check out Hitec's website.

brennerator 10-02-2007 23:11

Re: Rotating Servo HS322 over 90 degrees
 
I just want them to rotate 90 degrees! It has to be my program right? Its just the default code with the lines from post #1 slapped on.

Ken Streeter 11-02-2007 08:56

Re: Rotating Servo HS322 over 90 degrees
 
Quote:

Originally Posted by brennerator (Post 575814)
I just want them to rotate 90 degrees! It has to be my program right? Its just the default code with the lines from post #1 slapped on.

When you said earlier, "the servo doesn't even move," when you run the program, does the servo ever move at all? How about if you try to force it (with your finger) to go to a different position? When you try to turn the servo shaft to a different position, does it want to "fight back"?

If the servo doesn't seem to be doing anything at all (i.e. when you try to turn it to a different position, it doesn't "fight back") then I would speculate that the problem is that either the servo is not properly wired to the correct PWM output, or a charged 7.2V backup battery isn't connected to the RC. The servo motors get their power from the backup battery (not the main 12V battery) so a 7.2V battery needs to be connected to the RC for the servos to function at all.

Best Regards,

--ken

Alan Anderson 11-02-2007 13:23

Re: Rotating Servo HS322 over 90 degrees
 
Quote:

Originally Posted by brennerator (Post 575797)
...Im just using the stock default code and added in the code from post #1

Near the beginning of Default_Routine you will find this line:
Code:

  pwm11 = p3_wheel;
If it's still there, it might be undoing whatever your code is setting pwm11 to.

Use a Dashboard Viewer program to see what value pwm11 is actually being set to on the robot. That'll help narrow it down between software and hardware issues.

Vashts6583 12-02-2007 17:21

Re: Rotating Servo HS322 over 90 degrees
 
What I did to test-move some servos was remap joystick buttons to the PWM in which the servo was plugged. Basically, I deleted the original mapping (as mentioned above) and instead added code for two buttons, and it worked like a charm.

Also, try using the values 254 and 0, instead of 255, k?


All times are GMT -5. The time now is 04:47.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi