We use V5 C++ VCS.
We are trying to learn how to use the internal encoder on the V5 motor to control the tray height.
Our question is, how do we program so that the motor encoder knows where “0” dergrees of rotation is each time we turn the robot on without having to show it where it is?
Well you see, the problem is when using the built in encoders, whatever position the tray is in before you turn the robot on will read as 0. So if the tray is all the way out before your turn the Brain on, then that’s the 0 position. If it’s all the way back before you turn the brain on, then that’s the 0 position. To overcome this, you really should use a potentiometer as it will always read the same values even if the robot is off. This way, you will be able to code this “home” by finding the desired potentiometer value and setting the robot to go there. And since these values are consistently updated, even when the robot is on, you can easily track the tray and the robot will know where it is at all times. (I say 0 position as both degrees and rotations will be read as 0)