View unanswered posts | View active topics It is currently Sat Aug 24, 2019 9:16 am

Reply to topic  [ 3 posts ] 
Servo Help. 
Author Message

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Post Servo Help.
Alright, Im back again. We are headed to world once again, and have changed the robot up a bit, meaning new code is in need.

What I want to do.
Here is the servos I need to work with:
#pragma config(Servo,  srvo_S1_C4_3,    AlignL9,              tServoStandard)
#pragma config(Servo,  srvo_S1_C4_4,    AlignR10,             tServoStandard)

Now, I want to see if there is a way to make it, so that I can press a button, say 6, and I want AlignL9 and AlignR10 to go to a set postition (90 degrees out) and stay there without my finger on the button. BUT, I want to be able to have a button, say 8, that then allows AlignL9 and AlignR10 to go in a few degrees in when holding the button, and go back to the postion of the 90 degrees out, when I let go. Then when Im done, I can hit button 6 again, and it will go in to its first starting postition.

Is there any way to do that? The reasoning behind it, is that I dont want the servos out all the way while im driving around, to be broken off by defence of another robot.

Hope that made sence. Thanks.

I know I can do this type thing....:
#include "JoystickDriver.c"  //Include file to "handle" the Bluetooth messages.

bool btn3Pressed = false;
bool MagnetGuardIsUp = false;
bool btn5Pressed = false;
bool LeftForkIsUp = false;
bool btn6Pressed = false;
bool RightForkIsUp = false;


   if(!btn5Pressed && joy2Btn(5))
      LeftForkIsUp = !LeftForkIsUp;
      btn5Pressed = true;
    else if(!joy2Btn(5))
      btn5Pressed = false;
    servoTarget[forkL7] = 39;//Open
     servoTarget[forkL7] = 150; //Closed

Sat Mar 10, 2012 1:24 am

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Servo Help.
This shouldn't be too difficult, however I am having a little trouble understanding your control scheme. You state that you'd like btn 6 to move the servos to 90 degrees out and that when you let go of btn 8, that the servos also go to 90 degrees out. Then at the end you state that you'd like btn 6 to be able to set the servos back to their original position.

Is that 'first starting position' the 90 degrees out or is is there another position you had in mind which was not described? Would you want btn 6 to move the servos to both the initial starting position and the 90 degree out position?


Mon Mar 12, 2012 1:11 pm

Joined: Mon Oct 18, 2010 9:31 pm
Posts: 91
Post Re: Servo Help.
Hey, sorry. Alright.

AlignL9 and AlignR10 will start out at 0
1) I want to press button 6 to move them out 90 degrees and stay there when I let go of the button.
2) I want to press button 8 then after(with them at the 90 degrees already from step 1, and go in 10 degrees when I hold the button down, and when I let go, it goes back to the 90 degrees in step 1.
3) When Im done, I hit button 6 again, and it goes back to 0.

Hope that help.

Tue Mar 13, 2012 2:10 am
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.