|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#9
|
||||
|
||||
|
Re: General Q's
I am going to be non-secretive(As most teams are) and share my code in the UserRoutines.c . I am going to just hook up a spike instead of a speed controller. I figure hardware editing is quicker than software editing in this case. This snippet comes from the Buttons to Relay mapping part. Enjoy!
/*---------- Buttons to Relays---------------------------------------------- *-------------------------------------------------------------------------- * This default code maps the joystick buttons to specific relay outputs. * Relays 1 and 2 use lim it switches to stop the movement in one direction. * The & used below is the C symbol for AND */ if (p2_sw_trig<>0) /*If the opposites trigger is down. */ { } /*Do nothing.*/ else { relay1_rev = p1_sw_trig & rc_dig_in01; /* REV only if switch1 is not closed. */ } relay1_rev = p1_sw_top & rc_dig_in02; /* REV only if switch2 is not closed. */ if (p1_sw_trig<>0) /*Same as above. */ { } else { relay1_fwd = p2_sw_trig & rc_dig_in03; /* FWD only if switch3 is not closed. */ } relay2_rev = p2_sw_top & rc_dig_in04; /* REV only if switch4 is not closed. */ relay3_fwd = p3_sw_trig; relay3_rev = p3_sw_top; relay4_fwd = p4_sw_trig; relay4_rev = p4_sw_top; relay5_fwd = p1_sw_aux1; relay5_rev = p1_sw_aux2; relay6_fwd = p3_sw_aux1; relay6_rev = p3_sw_aux2; relay7_fwd = p4_sw_aux1; relay7_rev = p4_sw_aux2; relay8_fwd = !rc_dig_in18; /* Power pump only if pressure switch is off. */ relay8_rev = 0; All it does is wire Port 1 joystick trigger to reverse on our arm and port 2 trigger to forward. If a trigger is already down then ingnore the new command. I have very little C experience, so I hope this code is valid. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| General Dynamics? | Mike Rush | General Forum | 1 | 31-01-2003 17:04 |
| General Forum congestion | archiver | 2001 | 7 | 24-06-2002 03:32 |
| general forum threads | archiver | 2001 | 8 | 23-06-2002 22:47 |
| 2 Useful Websites - And general tips and Ideas | Robby O | 3D Animation and Competition | 0 | 13-01-2002 02:03 |