|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
||||
|
||||
|
Quote:
For example: // set the condition to 1 for gamepad assignments #if (1) #define LEFT_DRIVE 254-p1_y #define RIGHT_DRIVE 254-p1_x // change the above condition to 0 to use joystick assignments #else #define LEFT_DRIVE p1_y #define RIGHT_DRIVE p2_y Or if you like, you could use a switch on the O/I to select from joy to gamepad. Preprocessor define will not work for this. You would use the same logic but during program flow. #define LEFT_DRIVE pwm01 #define RIGHT_DRIVE pwm02 // if switch is true, use gamepad assignments if(switch_x) { LEFT_DRIVE = 254-p1_y; RIGHT_DRIVE = 254-p1_x; } // if switch is not true, use joystick assignments else { LEFT_DRIVE = p1_y; RIGHT_DRIVE = p2_y; } |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Inverting Joysticks? | The yellowdart | Programming | 5 | 20-02-2006 20:05 |
| Dual-Axis Accelerometer | naor52 | Programming | 18 | 27-01-2006 22:06 |
| Reversing the joystick axis | JBotAlan | Programming | 3 | 09-02-2005 19:47 |
| Inverting Y axis on joystick | FormatteD_C | Programming | 7 | 24-02-2004 16:56 |
| switching joystick axis????? | team222badbrad | Technical Discussion | 9 | 16-01-2002 23:07 |