View unanswered posts | View active topics It is currently Thu Jul 24, 2014 1:51 am






Reply to topic  [ 5 posts ] 
servo help 
Author Message
Rookie

Joined: Sat Mar 07, 2009 11:54 am
Posts: 2
Post servo help
hey everyone, im a new programmer, just practically started weeks ago... and i need an experts help. me and my group have managed to get the dc motors to work for the joystick settings, and we now have the arm on, but idk what the code is for the servos if i could get some help on this, it would be much appreciated.


Sat Mar 07, 2009 12:01 pm
Profile
Novice

Joined: Fri Oct 24, 2008 8:58 am
Posts: 87
Post Re: servo help
if you give more specifics about how your robot is configured and connected, I'm sure we can help get something together.


Sat Mar 07, 2009 4:41 pm
Profile
Rookie

Joined: Sat Mar 07, 2009 11:54 am
Posts: 2
Post Re: servo help
well, we were running it off the basic FTC-Joystick sample program, and added a button to it, and for the button i had these settings

if(joy1Btn(1) != 0)
{
servoTarget[servo1] = 240;
}
else
{
servoTarget[servo1] = 50;
}

no matter what, it wouldnt work, and we plugged everything up according to the diagram in the book. after countless tries i gave up, and went here to post that, and then evenutally i downloaded the newest version of robotc (1.46) and then opened up one of the dual joystick sample programs, and changed the code for the button which was:

if(joy1Btn(1))
{
motor[motorA] = 50;
}
else
{
motor[motorA] = 0;
}

to

if(joy1Btn(1))
{
servoTarget[servo1] = 240;
}
else
{
servoTarget[servo1] = 50;
}

and it worked. now the only thing Q i have is, why is it working now?


Sat Mar 07, 2009 5:33 pm
Profile
Expert
User avatar

Joined: Tue Oct 14, 2008 7:16 pm
Posts: 171
Location: Investigating an unidentified ship sighted in Sector 31428
Post Re: servo help
That is quite strange; are you sure you had the servos set up properly in the Motors and Sensors Setup dialog?
This may, may have something to do with the following line,
rickf wrote:
Code:
if(joy1Btn(1) != 0)


Which in the sample is simply,
Code:
if(joy1Btn(1))

Play around with it a bit and see.
There should be no real problem in doing it as in the former, though I would not necessarily do it that way, but I don't know, this whole system is hinky.

_________________
Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
Code:
using namespace System;
using namespace Genius;
using namespace Personality;
public ref class Nerd : Geek, IAnserable
{
    Geek::Type brainMode = Geek::Type::Programmer;
}


Sat Mar 07, 2009 10:46 pm
Profile
Novice

Joined: Fri Oct 24, 2008 8:58 am
Posts: 87
Post Re: servo help
I'm glad that its working now for you and yes its frustrating when things work and you don't know why.

I've heard that previous versions of RobotC didn't support the Hitechnic servos correctly (if at all), so depending on how old a version you had maybe that is the problem.


Mon Mar 09, 2009 9:19 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.