CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

2 servos

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ashrafkhatri



Joined: 06 May 2008
Posts: 14

View user's profile Send private message

2 servos
PostPosted: Wed Aug 02, 2017 1:41 am     Reply with quote

hi,
I am working on two servos. Both servos are working but i am stuck now.
I want to make a code with the following settings:

Note: these servos operate on analog input:
Condition 1: at analog input 0-10 both servos are closed.
Condition 2: at analog input 10-50, only servo 1 operates from position 0 to full, while servo 2 is remain closed.
Condition 3: at analog input 51-100, servo 1 is already fully opened and servo 2 is now operate from 0 to full for this range.

Kindly suggest me a good piece of code for the above said conditions.
thanks
Ashraf
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Wed Aug 02, 2017 4:20 am     Reply with quote

School project ?
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Aug 02, 2017 4:28 am     Reply with quote

This is not a do it for you forum, we will however offer guidance.

Show us how you control just the one servo.
Program needs to be complete and compilable.
Then we may be able to offer some help.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19537

View user's profile Send private message

PostPosted: Wed Aug 02, 2017 4:44 am     Reply with quote

There are also some strange terms being used. Talking about a servo being 'closed'?.
He must think about hysteresis. A voltage will not read as a simple stable 'number', and at the transition values like '10', you risk having the servo hunt.

There is basic 'operate a servo' code supplied with the compiler, and in the code library.
ashrafkhatri



Joined: 06 May 2008
Posts: 14

View user's profile Send private message

PostPosted: Wed Aug 02, 2017 4:45 am     Reply with quote

Let me do some more work on it. Then i will ask the same question with a written code if needed.
Thanks for your tip.
Ashraf
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Aug 02, 2017 9:17 am     Reply with quote

You should post a link to the servos you are using to help us help you.
'servo' means different things to different people. A 'servo' could mean a typical RC style 'hobby' servo, runs off 5 volts with NO feedback. To me a 'servo' means a heavy duty DC motor with gear trains and a 1024 optical encoder for position sensing. How you control the 'servo' will be based on the type of servo.


I see two 'functions' for your program

1st a 'control' function that determines which servo to operate based upon the ADC input value. This function is simple, read the ADC and have a 3 part 'switch'.
the 2nd function is a 'servo operation' function, where the selected servo is commanded to operate, I'm assuming from a second ADC input ??

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group