View Single Post
  #1   Spotlight this post!  
Unread 17-02-2007, 02:17
brennerator brennerator is offline
Registered User
#1560
 
Join Date: Jan 2005
Location: Silicon Valley
Posts: 75
brennerator is an unknown quantity at this point
Holding a position in our arm

Heres the deal:

We have a revolute double jointed arm; say we wnat to hold the lower portion of the arm in one place; how would we do so?

We have a potentiometer mesaureing the position values of the arm. Lets say we want the arm at a target val of 180. The arm is plugged into pwm02. We made some simple if/then statements...

Please ignore syntax.

sensor = Get_Analog_Value(rc_ana_in02);
targetval = 180;
if (sensor < targetval)
{
pwm02 = (127 + 53);
else
{
pwm02 = (127 - 53);
}

This makes the arm oscillate at the target value, and it oscillates way too much. How can we essentially LOCK the arm through programming?