help with code for optical shaft encoder

Can someone please explain the code for the optical shaft encoder to us. we are having trouble understanding the what each part of the code means. we are using robotc
this the code we are using

task main()
{
int value;

// assume motor is on port 1
motor port1 ] = 127;
// delay while motor accelerates
wait1Msec( 500 );

// clear encoder, enc should be the digital port that the encoder is on
SensorValue enc ] = 0;

// wait for 1 second
wait1Msec(1000);
value = SensorValue enc ];

// stop motor
motor port1 ] = 0;

// send to stdio
writeDebugStreamLine("encoder count is %d", value );

// done
while(1)
    wait1Msec(10);

}

I’ll use /* */ comments to separate them from the others.

task main()
{
/* This is to hold the value read from the encoder further down. */
int value;

/* Run the motor at full speed, but don’t assume that will happen instantly. So set it to the maximum value and give it a little time to reach full speed. */
// assume motor is on port 1
motor port1 ] = 127;
// delay while motor accelerates
wait1Msec( 500 );

/* The goal is to see how much rotation there is in 1 s. The easiest way to do this is to start with a value of 0, wait 1 s, and read the value right at the end of the 1 s. So this is what is done. */
// clear encoder, enc should be the digital port that the encoder is on
SensorValue enc ] = 0;

// wait for 1 second
wait1Msec(1000);
value = SensorValue enc ];

/* Turn off the motor now that we’re done with the process. */
// stop motor
motor port1 ] = 0;

/* We want to know the value, so write the value to the DebugStream to be read on the connected computer. */
// send to stdio
writeDebugStreamLine(“encoder count is %d”, value );

/* All this is is doing nothing forever. The reason is to give time before the program ends so you have plenty of time to read the value you just acquired. */
// done
while(1)
wait1Msec(10);
}

Thank you for the help.Also do you know how to make it go backwards?

Just change one line:

motor port1 ] = 127;

becomes

motor port1 ] = -127;

thanks dude one more question. can u give me a sample code to make the motors go fowards stop backwards stop please.

For RobotC,

motor[portX] = positive number makes the motor on port X go forward

motor[portX] = zero makes the motor on port X stop

motor[portX] = negative number makes the motor on port X go backwards

wait1Msec(t) makes the robot wait t milliseconds before doing the next thing

The order these should go in and which values you would like filled in to accomplish your goal is left as an exercise for the reader.

This is going to have the technical part and need to have the code for the process where you will going to have the encoding part so netgear tech support will provide you the best information to avail the code for the user so they can able to follow it and proceed it for the working part.