Go to Post You are not allowed to think outside of the box, but you are allowed to think diagonally in the box. - eugenebrooks [more]
Home
Go Back   Chief Delphi > Technical > Pneumatics
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
  #2   Spotlight this post!  
Unread 18-02-2007, 03:33
Ari Allyn-Feuer Ari Allyn-Feuer is offline
Registered User
FRC #0753
 
Join Date: Feb 2006
Location: Bend, OR
Posts: 22
Ari Allyn-Feuer is on a distinguished road
Re: Need critique of programming idea and info!!!

Basically, the way you access the button inputs on the joysticks (not addressing switch breakout boxes and the like) is by using the button flags that the IFI default code uses (of course you can edit the #defines). The tags look like p1_sw_trig. There's p1, p2, p3, p4 (for the four joystick ports on the OI) and sw_trig (trigger), sw_top (thumb on the kit JSs), sw_aux1, sw_aux2.

The relay outputs have two parts, fwd and rev. For pistons, you always want rev to be 0, and forward is 1 if you want the piston forward and 0 if you want it to retract.

The way I turn a button into a toggle and use it to control a relay is like this. You make an unsigned char called "p3_sw_trig_old", and at the end of your routine put:

p3_sw_trig_old = p3_sw_trig;

so that the RC will remember how the button was last time. The times you want to switch the output is the very first loop they push the switch, and then to wait until they press it again. So you do something like:

if(p3_sw_top && !p3_sw_top_old) //If it's pressed but wasn't last loop.
{
relay_1_fwd = 1 - relay_1_fwd; //Toggle the relay's forward part.
relay_1_rev = 0;
}

I hope this helps. Post again with any more issues.

Ari.
 


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
Need help Programming and wiring camera! Amisca Programming 1 14-02-2006 18:37
need scouting info from teams 966 and 970!!!! jeffwalsh Scouting 0 05-02-2003 15:48
We NEED 8-inch wheels and programming help archiver 2001 7 24-06-2002 00:29
Need info on how to build temp. receiver and transmitter archiver 1999 5 23-06-2002 22:01


All times are GMT -5. The time now is 12:13.

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