|
team17
Rookie
Joined: Fri Apr 10, 2009 6:55 pm Posts: 1
|
 DC motors won't move! Need help!!!
We need to get the dc motor for our arm moving, but we're getting a bytecode exception error that says "motor out of range(2)."
We have two DC motor controllers and one servo controller.
The first DC motor controller is on S1 and the second is on S2.
Please help... we need to find a solution in the next 48 hours.
Below is our code:
#pragma config(Hubs, S1, HTMotor, none, none, none) #pragma config(Hubs, S2, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, openLoop) #pragma config(Motor, mtr_S2_C1_1, motorF, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { motor[mtr_S2_C1_1] = 100; wait1Msec(1000); motor[mtr_S2_C1_1] = 0; wait1Msec(1000); }
|
|
Atlantisbase
Expert
Joined: Tue Oct 14, 2008 7:16 pm Posts: 171 Location: Investigating an unidentified ship sighted in Sector 31428
|
 Re: DC motors won't move! Need help!!!
To begin with, you should name your motors something other than "motorD"; give them a meaningful name indicitive of their use. Second, and this may be your problem, when you turn a motor on don't use the internal name of mtr_S1_C1_1 use the name you gave it.
Hope this helps.
_________________Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
|
|
10nisman94
Novice
Joined: Mon Oct 13, 2008 6:29 pm Posts: 75 Location: Florida, USA
|
 Re: DC motors won't move! Need help!!!
also, any reason to use two sensor ports for your motor controllers? try using one (if you already haven't)
_________________ PHUHS Robotics Team 516 FTW
Daytona Robofest Winning Alliance Captain Daytona Robofest Inspire Award
|