View unanswered posts | View active topics It is currently Wed Jul 23, 2014 9:36 am






Reply to topic  [ 4 posts ] 
HELP ENCODER NOT WORKING 
Author Message
Rookie

Joined: Wed Feb 02, 2011 10:45 pm
Posts: 3
Post HELP ENCODER NOT WORKING
we have tried everything including the sample programs and still the enconder doesn't work, the pragmas seem to be right and the cables are well plugged in to the controller, therefore the encoder should work but it isnt working! we would really appreciate some help


Wed Feb 02, 2011 11:26 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3162
Location: Rotterdam, The Netherlands
Post Re: HELP ENCODER NOT WORKING
Without code it is really hard to guess what could be wrong.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 03, 2011 1:58 am
Profile WWW
Rookie

Joined: Wed Feb 02, 2011 10:45 pm
Posts: 3
Post Re: HELP ENCODER NOT WORKING
here is the code with the pragmas and everything;

#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main ()
{
nMotorEncoder[motorE]= 0; //Tetrix encoder reset

nMotorEncoderTarget[motorE]= 1440; // Position

motor[motorE] = 20;

}


Thu Feb 03, 2011 10:11 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: HELP ENCODER NOT WORKING
Your program ends right after setting the motor in action. When the program ends, it kills your motor. If you want to see the motor moving put a wait after you set the motor.
Code:
#pragma config(Hubs, S1, HTMotor, none, none, none)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorNormal, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main ()
{
    nMotorEncoder[motorE]= 0; //Tetrix encoder reset
    nMotorEncoderTarget[motorE]= 1440; // Position
    motor[motorE] = 20;
    wait1Msec(5000);   //wait 5 seconds
}


Thu Feb 03, 2011 1:45 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.