View Single Post
  #7   Spotlight this post!  
Unread 01-02-2003, 18:50
n[ate]vw's Avatar
n[ate]vw n[ate]vw is offline
Registered User
#0933 (Adler Attack)
 
Join Date: Jan 2003
Location: Rockford, IL
Posts: 48
n[ate]vw is an unknown quantity at this point
Send a message via AIM to n[ate]vw
I might be misunderstanding the issue, but it seems you are trying to make a servo, i.e. the motor turns until the feedback pot and the control pot give the same value.

[edit]Your code seems to be unnecessarily complex, [/edit]
...wouldn't

if feedback_pot < control_pot then [turn motor one way]
if feedback_pot > control_pot then [turn motor other way]

work for this?

[edit]
You could tweak the if...then statements a bit to allow slight error:

if feedback_pot+255 < control_pot +245 then [one way]
if feedback_pot+255 > control_pot +265 then [other way]
[/edit]
__________________
Adler Attack #933 -- Trigos

Last edited by n[ate]vw : 01-02-2003 at 18:59.