
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































Left motor
Limited system capability
Our use of motors
Programming in NXC
Calibration function “Distant_Check”
Calibration function “Distant_Check”
The program checks the speed of the robot at given surface and battery life.
The program starts with defining the ultrasonic sensor, input port 4, and driving motor as output port A & C. Integers dist1, dist2, dist_avg, i defined.
#define US SENSOR_TYPE_LOWSPEED_9V //define US as the Ultra Sonic sensor #define Motor OUT_AC //driving motor #define US_IN IN_4 //US sensor input
task main() { int dist1; int dist2; int dist_avg; int i;
This last section of task maim outputs dist_avg on the NXT
LCD screen until the user cancels the operation
while (true)
{
Off(Motor);
NumOut(0, LCD_LINE2, dist_avg);
}
}
End of task main is here
“Rotation_Check”
Calibration function “Rotation_Check”
This program checks the rotation angle on the
given surface and between left and right
motor. It is used only for calibration