Go to Post My team heard another team describe the Championships as "10,000 kids jamming the Georgia Dome for 3 days…more nerds per square foot than a Star Trek convention…and more purposefully employed " Is this true?, Because I don't think there could possibly be a more wonderful place on earth - Emily3204 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 06-02-2008, 21:56
neutrino15's Avatar
neutrino15 neutrino15 is offline
plɹoʍ ollǝɥ
AKA: Jordan Perr
FRC #0694 (Stuypulse)
 
Join Date: Feb 2007
Rookie Year: 2007
Location: New York City
Posts: 162
neutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really niceneutrino15 is just really nice
Re: I am going crazy

Well, it depends on how your robot is designed, and what your program already has in it.
The button pushing part is easy, just look in dashboard to find the button you want. Something like the following will toggle up/down on press. You don't need to hold the button with this routine either:

Code:
//at the top:
#define BUTTON p3_sw_trig

//in the loop:
static char armMove;

if(BUTTON & armMove==0){
     if(the arm is down)
         armMove = 1;
     else
         armMove = 2;
}

if(armMove){//this uses the fact that both 1 and 2 will be true, while 0 will be false.
    if(moveArm(armMove))
        armMove = 0;
}

then, down the page (or in another file), you need to have a function that actually moves the arm, and returns true if the arm is done moving.

Code:
int moveArm(char way){
    char finished
    if(way == 1){
        //move the arm up, set pwms.
        //you probably want to use a PID loop.
        //return 1 if the arm is there already, and set the pwm to 127.
    } else {
        //move the arm down, set pwms.
        //you probably want to use a PID loop.
        //return 1 if the arm is there already, and set the pwm to 127.
    }

   return 0;

Thats the way I would attempt to do it. Depending on your bot, you may have to use some sort of a PID loop to get the arm to the correct position. If you use limit switches instead of a POT, you could probably do it with just a P loop.

Last edited by neutrino15 : 06-02-2008 at 22:01.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My error derivative is going crazy Nathans Programming 3 19-01-2008 17:56
crazy game Mike Ciance Fantasy FIRST 22 25-05-2004 11:37
Big for Joe! Going....Going..... archiver 2001 9 23-06-2002 23:29
crazy stuff chris144 Chit-Chat 19 08-04-2002 20:13


All times are GMT -5. The time now is 19:06.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi