|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
FRC Code (Motors, etc...)
Ok, if my memory serves me correctly, the default code uses the PWM01 & PWM08 for motor movement. Is there a way to change this? Also, how do you use PWM's exactly (I was dropped from the programmer's group last year, so most of the stuff left my mind)?
|
|
#2
|
||||
|
||||
|
Re: FRC Code (Motors, etc...)
Quote:
Code:
/*---------- 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. */ pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127); pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127); ) |
|
#3
|
||||
|
||||
|
Re: FRC Code (Motors, etc...)
Quote:
The RC on the robot has multiple PIN spots, each with their own possible values. So, you can plug any speed controller / relay into any PWM. You have to make sure that you designate it in the code, though. Here's an example: The default code mixes the X and Y values (X = Left/Right, Y = Up/Down) of one joystick on port 1. It then outputs it's values to PWM13, PWM14, PWM15, and PWM16. And another example: Let's say that you want Tank Drive. Obviously, that means that the left motors move the same way and the right move the same way. Use the following code to get tank drive. (By the way, this assumes that you have two joysticks, each hooked up to the OI on ports 1 and 2. Also, make sure that PWMs 1 - 4 are not given values anywhere in your existing code) Code:
pwm01 = pwm02 = p1_y; /* PWMs 1-2 are equal to each other, so put these on the left motors. p1_y means port 1, y-axis. So the left motors are controlled by one joystick when it is pushed forward.*/ pwm03 = pwm04 = p2_y; /* Much like the above code except that the PWMs are switched to 3-4 and p2_y is used instead. Connect pwm3-4 to your right motors.*/ |
|
#4
|
|||||
|
|||||
|
Re: FRC Code (Motors, etc...)
Thanks to you both
![]() I understand now (never quite understood how it all worked). |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FRC default code | hedgehogger | Programming | 2 | 21-01-2004 18:41 |
| Problem with FRC Default code | AsimC | Programming | 2 | 11-01-2004 19:22 |
| Looking for practice motors & extra tape drive parts? | archiver | 2000 | 1 | 23-06-2002 22:54 |
| "Motors and Drive train edition" of Fresh From the Forum | Ken Leung | CD Forum Support | 6 | 29-01-2002 12:32 |
| Drill Motors | TF8 | Motors | 19 | 12-12-2001 13:13 |