We are not going to use V5 this year, so I need help programming the shaft encoders. We tried to use them last year and could not figure how to program them correctly. Anybody have any advice or sample programs we could use?
Thanks
6024F
We are not going to use V5 this year, so I need help programming the shaft encoders. We tried to use them last year and could not figure how to program them correctly. Anybody have any advice or sample programs we could use?
Thanks
6024F
VCS does not support Cortex, so you will need to use RobotC, or other, for programming the legacy system.
I’m not familiar with programming in PROS, so I can only help you with the soon-to-be-outdated RobotC:
#pragma config(Sensor, dgtl9, r_encoder, sensorQuadEncoder)
// This configures an Optical Shaft Encoder named "r_encoder" with its two wires plugged into Digital Ports 9 and 10 of the cortex. Alternatively, you can just do it in Motors and Sensors setup.
task main()
{
SensorValue(r_encoder) = 0;
// This resets the value of your encoder to 0 to eliminate any existing error.
while (true)
{
if (SensorValue(r_encoder) < 1000)
{
// SensorValue(r_encoder) retrieves its value
// (Do something here like move a motor)
}
}
}
Thanks!