|
Page 1 of 1
|
[ 7 posts ] |
|
| Author |
Message |
|
KJKim
Rookie
Joined: Wed Oct 12, 2011 9:24 am Posts: 3
|
 Coding for Servos
Hi, I've been working on coding with RobotC recently and successfully got the motors to work. However, I was not able to get the servos to work. I have tried to code it in the simplest way such as:  |  |  |  | Code: #pragma config(Hubs, S1, HTServo, none, none, none) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Servo, srvo_S1_C1_1, servo1, tServoContinuousRotation) #pragma config(Servo, srvo_S1_C1_2, servo2, tServoNone) #pragma config(Servo, srvo_S1_C1_3, servo3, tServoNone) #pragma config(Servo, srvo_S1_C1_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main() { servo[servo1] = 255; wait1Msec(3000); servo[servo1] = 0; wait1Msec(3000); }
|  |  |  |  |
Is there something wrong in my code? I have everything connected in the right place. Please give your inputs, thank you all in advance for your supports.
|
| Wed Oct 12, 2011 9:32 am |
|
 |
|
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 495
|
 Re: Coding for Servos
What happens when you try this: Does the servo go all the way up?
_________________ sudo rm -rf /
|
| Wed Oct 12, 2011 10:23 am |
|
 |
|
l0jec
Expert
Joined: Mon Oct 27, 2008 9:59 pm Posts: 137
|
 Re: Coding for Servos
Using the servo debugger window is also an easy way to check for hardware/wiring problems vs. bad code.
One common problem I see a lot of FTC rookies make is to plug the servo wire into the controller backwards. Make sure you line the yellow wire up facing the top of the controller per the Y R B labeling on the servo controller. Also, you may want to double check that you have power to the controller & your pragmas are correct.
|
| Wed Oct 12, 2011 10:57 am |
|
 |
|
KJKim
Rookie
Joined: Wed Oct 12, 2011 9:24 am Posts: 3
|
 Re: Coding for Servos
i tried copy&pasting, and nothing happened =\ i tried using both continuous and not continuous servos but neither of them seemed to work. the debugger option under "robot" tab does not let me click anything, and i don't think it's a hardware/wiring problem because we have everything hooked up. I double checked that the yellow wire is facing the top of the controller, and it still didn't work
|
| Wed Oct 12, 2011 12:10 pm |
|
 |
|
l0jec
Expert
Joined: Mon Oct 27, 2008 9:59 pm Posts: 137
|
 Re: Coding for Servos
I also just reread your pragmas.... Is your servo a standard servo or a continuous rotation servo? You have it configured as a continuous rotation servo. As far as your wiring and hardware, did you use a multi-meter to check that the controller is in fact getting power? Note that low 12v batteries can also trip you up.
|
| Thu Oct 13, 2011 8:22 am |
|
 |
|
KJKim
Rookie
Joined: Wed Oct 12, 2011 9:24 am Posts: 3
|
 Re: Coding for Servos
i have tried both standard and continuous servos with the corresponding configurations, and neither have worked. the battery is full of juice; the servo controller lights up brightly red. i don't understand why the servos are not working T-T
|
| Thu Oct 13, 2011 9:11 am |
|
 |
|
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 495
|
 Re: Coding for Servos
Wait a second. Take a look at this part of your code: Do you have a Servo controller plugged into S1 or a sensorMux?
_________________ sudo rm -rf /
|
| Thu Oct 13, 2011 9:36 am |
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 7 guests |
|
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
|
|