Go to Post [IRI] is like shaving the cream that has risen to the top of each championship division putting them into a blender and serving the concoction up to the FIRST community for dessert. - Koko Ed [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 23-01-2013, 15:33
Spacemonkey619 Spacemonkey619 is offline
Registered User
None #4899
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: California
Posts: 7
Spacemonkey619 is an unknown quantity at this point
Robotc NXT Encoder help

I'm using Robotc for NXT and I'm trying to learn the encoders. So i made a simple forward then left with encoders program. The robot runs the go forwards part but completely ignores the part were it is supposed to turn left. Can anyone help me out and tell me what i did wrong here?


task main()
{

nMotorEncoder[rightMotor] = 0; //clear the LEGO encoders in motors B and C+
nMotorEncoder[leftMotor] = 0;

while (nMotorEncoder[rightMotor] < 1500) //while the encoder wheel turns one revolution (360)
{
motor[rightMotor] = 50; //turn both motors on at 50 percent power
motor[leftMotor] = 50;
}

motor[rightMotor] = 0; //turn both motors off
motor[leftMotor] = 0;

wait1Msec(1000);

//new line

while (nMotorEncoder[leftMotor] < 500) //while the encoder wheel turns one revolution (360)
{
motor[rightMotor] = 50; //robot will turn left
motor[leftMotor] = 0;
}

motor[rightMotor] = 0; //turn both motors off
motor[leftMotor] = 0;


wait1Msec(3000); // wait 3 seconds to see feedback from the debugger screens
// open the "NXT Devices" window to see the distance the encoder
//spins. The robot will coast a little bit.
}
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:35.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi