View unanswered posts | View active topics It is currently Wed Aug 05, 2020 10:13 am

Reply to topic  [ 1 post ] 
Code that makes nxt to keep rotating by some degree 
Author Message

Joined: Tue Mar 09, 2010 2:27 pm
Posts: 2
Post Code that makes nxt to keep rotating by some degree

Recently, I've been trying to write a code which makes robot to rotate for some degree around his axis, stop, and then continue the loop. But what happens is that even though I think I have synchronized my motors their encoder values still don't match and because of that robot keeps slightly moving to the right.

Here is my code:

void turn22(){
nMotorEncoder[motorA] = 0;
nSyncedMotors = synchAB;
nSyncedTurnRatio = -100;
motor[motorA] = 20;
}while(nMotorEncoder[motorA] != 50)
motor[motorA] = 0;

task main(){

bFloatDuringInactiveMotorPWM = false;
nMotorEncoder[motorA]       = 0;
nMotorEncoderTarget[motorA] = 0;
nMotorEncoder[motorB]       = 0;
nMotorEncoderTarget[motorB] = 0;
nSyncedMotors = synchAB;
nSyncedTurnRatio = -100;

while (true){

Can anyone tell me what I'm doing wrong? Thanks!

Tue Mar 09, 2010 2:48 pm
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest

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.