I have already wrote a program and it was successfully run in the debug mode. But when I unplugged the wire I don’t know how to run it. The program is supposed to be stored in the robot, so how can I run it?
Try turning the robot and joystick off then on again. When they finish connecting (all lights are green) it should run your code.
Do you have a joystick and VEXnet keys, or are you just running it with only the cortex on the robot? If it’s just the cortex, the code you downloaded is executed whenever the cortex is powered on. So you don’t need to turn the robot on and off every time, put your code in an infinite loop, with a command at the beginning to wait for i.e. a button to be pressed that will rerun the code.
Also check your communication mode is USB only http://www.robotc.net/wikiarchive/Tutorials/Getting_Started/Getting_Started_with_the_VEX_CORTEX#Step_7:_Setting_Cortex_Communication_Mode
what programming system do you need in oder to use shaft encoder
You can use any programming software, such as RobotC, EasyC, etc.