View unanswered posts | View active topics It is currently Thu Nov 27, 2014 3:03 pm






Reply to topic  [ 5 posts ] 
Servo Problem 
Author Message
Rookie

Joined: Thu Dec 18, 2008 4:52 pm
Posts: 5
Post 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 1849 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


Thu Dec 18, 2008 9:41 pm
Profile
Professor

Joined: Fri Sep 19, 2008 1:22 am
Posts: 200
Post 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?

_________________
Jeff McBride
Benson Robotics Club


Fri Dec 19, 2008 12:12 am
Profile
Rookie

Joined: Thu Dec 18, 2008 4:52 pm
Posts: 5
Post 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?


Fri Dec 19, 2008 12:23 am
Profile
Professor

Joined: Fri Sep 19, 2008 1:22 am
Posts: 200
Post 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.

_________________
Jeff McBride
Benson Robotics Club


Fri Dec 19, 2008 1:34 am
Profile
Rookie

Joined: Thu Dec 18, 2008 4:52 pm
Posts: 5
Post Re: Servo Problem
Thanks Alot


Fri Dec 19, 2008 1:40 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.