|
Page 1 of 1
|
[ 7 posts ] |
|
Need help with Program from Cortex to Controller
| Author |
Message |
|
ShadyMaple4
Rookie
Joined: Sun Sep 18, 2011 2:20 pm Posts: 8
|
 Need help with Program from Cortex to Controller
We are very confused please help!!!!!! Could someone post a program that will allow all the channels on the cortex to function with the remote?
Ours only allows chanels 1-4. We really need channels 5 and 6 to work!
Heres what we have...it's probably not correct:
#pragma config(Motor, port2, boom, tmotorNormal, openLoop) #pragma config(Motor, port3, ldrive, tmotorNormal, openLoop) #pragma config(Motor, port4, rdrive, tmotorNormal, openLoop) #pragma config(Motor, port5, intake, tmotorServoStandard, openLoop) #pragma config(Motor, port6, intake1, tmotorServoStandard, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { while (1 == 1) { motor[port2] = vexRT(Ch2); motor[port3] = vexRT(Ch3); motor[port4] = vexRT(Ch4); motor[port5] = vexRT(Ch5); motor[port6] = vexRT(Ch6); } }
|
| Fri Nov 18, 2011 9:32 am |
|
 |
|
jbflot
Site Admin
Joined: Tue May 15, 2007 9:02 am Posts: 383
|
 Re: Need help with Program from Cortex to Controller
The problem that you're having is that there are no Channels 5 and 6 on the VEXnet Joystick. These are valid names because the older style Radio Control Transmitter did have Channels 5 and 6.
All of the buttons on the VEXnet remote are accessed using the letters "Btn" + the number closest to the button + the letter etched into the button. For example, "vexRT[Btn5D]". These buttons provide values of 0 or 1, not -127 to 127.
|
| Fri Nov 18, 2011 10:02 am |
|
 |
|
ShadyMaple4
Rookie
Joined: Sun Sep 18, 2011 2:20 pm Posts: 8
|
 Re: Need help with Program from Cortex to Controller
That makes sense! Can you give a small example of how that looks in the code?
|
| Fri Nov 18, 2011 10:05 am |
|
 |
|
jbflot
Site Admin
Joined: Tue May 15, 2007 9:02 am Posts: 383
|
 Re: Need help with Program from Cortex to Controller
Here's a sample program that we use in our video tutorials and is included in ROBOTC:
|
| Fri Nov 18, 2011 10:11 am |
|
 |
|
ShadyMaple4
Rookie
Joined: Sun Sep 18, 2011 2:20 pm Posts: 8
|
 Re: Need help with Program from Cortex to Controller
If I copy and paste that code and Compile it, I get 3 errors:
**Error**:Undefined variable 'leftMotor'. 'short' assumed. **Error**:Undefined variable 'rightMotor'. 'short' assumed. **Error**:Undefined variable 'armMotor'. 'short' assumed.
How do you assign the 0 or 1 to each motor. Assuming that means On or Off. ???
|
| Fri Nov 18, 2011 10:21 am |
|
 |
|
jbflot
Site Admin
Joined: Tue May 15, 2007 9:02 am Posts: 383
|
 Re: Need help with Program from Cortex to Controller
You get an error because you haven't configured the motors in the Robot > Motors and Sensors setup menu. If you want to drive the motors with the buttons, you can't just use a 1 or 0 as the value. Instead you have to say something like... We have tutorial videos that give good, detailed explanations about all of this. If you're just getting started I highly recommend checking them out: http://www.education.rec.ri.cmu.edu/pro ... tc_cortex/ For topics related to this, you should go to the Remote Control section and watch the videos in the Joystick Mapping and Buttons sections.
|
| Fri Nov 18, 2011 10:34 am |
|
 |
|
ShadyMaple4
Rookie
Joined: Sun Sep 18, 2011 2:20 pm Posts: 8
|
 Re: Need help with Program from Cortex to Controller
 |  |  |  | Code: #pragma config(Motor, port1, x, tmotorServoStandard, openLoop) #pragma config(Motor, port2, boom, tmotorServoStandard, openLoop) #pragma config(Motor, port3, ldrive, tmotorServoStandard, openLoop) #pragma config(Motor, port4, rdrive, tmotorServoStandard, openLoop) #pragma config(Motor, port5, armMotor, tmotorServoStandard, openLoop) #pragma config(Motor, port6, armMotor, tmotorServoStandard, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { while (1 == 1) { motor[port2] = vexRT(Ch2); motor[port3] = vexRT(Ch3); motor[port4] = vexRT(Ch4); motor[port5] = vexRT(Ch5); } if(vexRT[Btn5U] == 1) { motor[port5] = 127; } else if(vexRT[Btn5D] == 1) { motor[port5] = -127; } else { motor[armMotor] = 0; } }
|  |  |  |  |
|
| Fri Nov 18, 2011 10:51 am |
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: fretless_kb and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|