/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++++Mission 8 - Line Tracking- This program will cause your robot to follow the line toward the next Starting Point using feedback from the light sensor.- Your robot will wait for 2 seconds before beginning, move forward at half power for 360 encoder counts of the right motor encoder, then track the line using the light sensor, for 1800 encoder counts of the right motor encoder.- ROBOTC must be in Natural Language mode for this prsogram to run. You can set this in the top menu by going to Robot > Platform Type > LEGO Mindstorms > Natural Language (NXT).* Please note that the values in this program were written for Mammalbot using a high-end computer. You may need to adjust the values in this program for your computer.

//Clear the value in the right motor encoder nMotorEncoder[rightMotor] = 0; //While less than 5 rotations of the encoder have been counted while(nMotorEncoder[rightMotor] < 1800) { //If the light sensor sees the line, swing turn left if(SensorValue[lineFollower] > 35) { swingTurn(left, 80); } //Else, if it doesn't see the line, swing turn right else { swingTurn(right, 80); } }

//Add the rest of your code here!}

The program is in Natural Language. You can see that the threshold is 35. To see the threshold values for any of the virtual worlds, you'd want to do the same thing. Use the programs in the sample programs folder as a reference. If there is anything else you have a question about, please don't hesitate to ask.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum