|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||
|
|||
|
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 |
|
|
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 |