|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#13
|
|||
|
|||
|
Re: PWM Problem with Default Code
Here is the section of source code that is found in file user_routines.c that maps the joystick inputs to the PWMs
/*---------- Analog Inputs (Joysticks) to PWM Outputs----------------------- *-------------------------------------------------------------------------- * This maps the joystick axes to specific PWM outputs. */ pwm01 = p1_y; pwm02 = p2_y; pwm03 = p3_y; pwm04 = p4_y; pwm05 = p1_x; pwm06 = p2_x; pwm07 = p3_x; pwm08 = p4_x; pwm09 = p1_wheel; pwm10 = p2_wheel; pwm11 = p3_wheel; pwm12 = p4_wheel; /*---------- 1 Joystick Drive ---------------------------------------------- *-------------------------------------------------------------------------- * This code mixes the Y and X axis on Port 1 to allow one joystick drive. * Joystick forward = Robot forward * Joystick backward = Robot backward * Joystick right = Robot rotates right * Joystick left = Robot rotates left * Connect the right drive motors to PWM13 and/or PWM14 on the RC. * Connect the left drive motors to PWM15 and/or PWM16 on the RC. */ p1_x = 255 - p1_y; p1_y = 255 - pwm05; pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127); pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127); Note that if you are using two joystick drive, that pwm01 and pwm02 should be connected to the motor speed controler, but if you want to use 1 joystick drive, the motor speed controlers should be contected to pwm13 and the other to pwm15. You would not have to modify the code one bit. However, if you want to modify the code to change the way the joysticks control the pwms, then the above section of the source code is the place to do it. Last edited by N7UJJ : 03-02-2007 at 09:57. Reason: spelling errors |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with Kevin's 2007 default code | bruss6 | Programming | 8 | 19-01-2007 15:42 |
| problems using gyro/adc code with camera default code | tanstaafl | Programming | 7 | 22-01-2006 23:09 |
| Default code problem | capenga | Programming | 8 | 01-02-2005 08:09 |
| problem with the default code | MarkVH | Programming | 7 | 28-01-2005 00:04 |
| Problem with FRC Default code | AsimC | Programming | 2 | 11-01-2004 19:22 |