ROBOTC.net forums
http://www.robotc.net/forums/

Servo Problem
http://www.robotc.net/forums/viewtopic.php?f=52&t=1043
Page 1 of 1

Author:  Marco [ Thu Dec 18, 2008 9:41 pm ]
Post subject:  Servo Problem

Hi, I tried running a simple test on the motors with a brief program, but for some reason the servos do not respond.

Here is the program:
Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "JoystickDriver.c"

task main()
{
  while (true)
  {
    getJoystickSettings(joystick);
    motor[motorD] = joystick.joy1_y1;
    motor[motorE] = joystick.joy1_y2;
    if (joy1Btn(1))
    {
      servoTarget[servo1] = 50;
    }
  }
}


My wiring is as exactly shown on the TestBed below, however the 'Sonar' and 'NXT Motor' were not connected:
Attachment:
testbed.jpg
testbed.jpg [ 26.56 KiB | Viewed 3773 times ]


When I used the analogs on the controller, the two DC Motors functioned perfectly. However, when I pressed button # 1, the servo did not respond.

Any suggestions? Any help would be very appreciated.

-----------------------

Do the 'pragma configurations' definitions have anything to do with it?

For example, the two motors are mentioned in the following codes:

Code:
#pragma config(Motor,  mtr_S1_C1_1,     motorD,        tmotorNormal, PIDControl)
#pragma config(Motor,  mtr_S1_C1_2,     motorE,        tmotorNormal, PIDControl)


Should I have a 'pragma config' code for the servos as well?

Thanks,
Marco

Author:  Jeff McBride [ Fri Dec 19, 2008 12:12 am ]
Post subject:  Re: Servo Problem

You need to make sure that you use the Motor and Sensor Setup wizard on the Robot menu to create all of your #pragmas. Do NOT try to do it by hand. You need to make sure to go to the servos page of the wizard and tell it what servo ports are in use. That will generate an additional #pragma statement for each servo.

What version of RobotC are you running?

Author:  Marco [ Fri Dec 19, 2008 12:23 am ]
Post subject:  Re: Servo Problem

I'm running on 1.40

Ok, so I go to:

Robot > Motors and Sensors Setup > Servos

and then define the names and it does it for me...it should work after that?

Author:  Jeff McBride [ Fri Dec 19, 2008 1:34 am ]
Post subject:  Re: Servo Problem

It won't work with 1.40. You need to upgrade to 1.46. You can find it here:
http://www.education.rec.ri.cmu.edu/content/events/ftc/robotc/

Make sure that you completely uninstall 1.40 before installing 1.46 or it won't work right.

Once you've done that I suggest that you go through the Motor and Sensor Setup wizard again since there were a lot of changes between 1.40 and 1.46 which affect the contents of the #pragmas generated by the wizard. Then you should have a lot more luck with your servos.

Author:  Marco [ Fri Dec 19, 2008 1:40 am ]
Post subject:  Re: Servo Problem

Thanks Alot

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/