This year we are using 3-wire optical shaft encoders on our wheels. However, I have realised that one of the encoders consistently does not count accurately. After a few runs of working properly, the encoder just decided to cease working. The encoder either counts slower than the other working side or just counts to X value and stops counting for a few seconds. I have tried many available solutions such as replacing the encoder 5 times, replacing the entire brain, cleaning each encoder slot before using it, and changing the encoder to diff ports, every port from C, D to G,H. However, it is consistently the encoder not on A, B that dies, and the one on A B always works and has never broken. Does anyone know how to solve this issue?
Can you post your code (using the three ticks ``` for formatting)?
If I were to guess, I would ask if you have
wait(20, msec); inside your while loop to prevent the thread from consuming the processor.
no code is involved, we are simply spinning the encoder X degrees and seeing it report Y degrees on the v5 brain “devices” menu