View Single Post
  #6   Spotlight this post!  
Unread 12-03-2012, 20:52
seg9585's Avatar
seg9585 seg9585 is offline
Registered User
AKA: Eric
FRC #4276 (Surf City Vikings)
Team Role: Engineer
 
Join Date: Feb 2006
Rookie Year: 2001
Location: Boeing (Seal Beach, CA)
Posts: 520
seg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond repute
Re: how to creat a home button

Quote:
Originally Posted by pickett View Post
I am having trouble getting the potentiometer to work. when I run the code the window motor hooked up to the turret runs continuously in on direction. can some on take a look at my code attached below?

I am looking to control the turrets turn radius and create a home button.
I'm trying to interpret exactly what are are looking to do with Button 4 and Button 5.
As-is:
It appears that when nothing is pressed, the PID target is always 1.17 (pot min)
When Button 4 is pressed, the PID target becomes 3.9 (pot max)
When Button 5 is pressed, the PID target becomes -(3.9 - 1.17) + 1.17 = -1.56 (out of range)


For this "Home" button are you trying to drive to a mid-value?
If so, when a button is pressed, you should be setting the setpoint to [(3.9-1.17)/2]. You can just put this into a Case structure where the selected Button determines the Case, and if True, run the PID loop. If false, use your other turret logic to specify your motor power.

If this is not what you are trying to do, please describe explicitly your desired function (what you want each button to do, etc).
__________________
My FIRST legacy:

Team 204 Student 2001, 2002 (Voorhees, NJ)
Team 1493 College Mentor 2006 - 2008 (Troy, NY)
Team 2150 Intern/Professional Mentor 2007, 2009 (Palos Verdes)
Team 4123 Lead Engineering Mentor 2012 (Bellflower, CA)
Team 4276 Engineering Mentor 2012-2016 (Huntington Beach, CA)
Reply With Quote