View Single Post
  #6   Spotlight this post!  
Unread 11-02-2011, 21:56
Triapod Triapod is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2005
Location: NJ
Posts: 28
Triapod is an unknown quantity at this point
Re: Programming an Arm?!?

Quote:
Originally Posted by 2829ron View Post
Have you considered doing a timed function? Motor will only run one way for a set amount of time and then stop. Then run the other way for a set time and stop.
I considered this before, but as your battery power decreases, the output you get from your motor also decreases. So even though the time is set, the distance traveled will not be the same. Also the resulting error adds up. I'd go with Mark's idea.

You can do the two motor controls in the same way. Just copy and paste the code you have for one motor: so, have two PID controls, each wired to one of the motors and one of the sensors. The program will be the same, just different device reference and different setpoints.