you only need to use the source A and B pins if you want to use the encoder, what is your question exactly? Are you wanting to know how to code for the motor and the encoder, or are you asking how to wire the encoder in?
this thread will help as well, it gives example code for converting the hall sensor data to a typical encoder input, which is then very easy to manipulate for whatever linear or rotational calculation you need.
The code given by the person in the thread didn’t work for us. Our counter was permanently increasing regardless of whether or not the motor is running, (every read showed it was increasing by ~50000 every new line).
So the question still stands, how do we implement the encoder so we can have usable data to see rotation.
Well, it should start at 0 and count +1 for each rotation. The super fun thing with these is that the sensor is on the motor output not the shaft output. The reduction on the motor is ~179:1 (dont’ quote me, look it up), therefore one output shaft rotation would be 179 ticks.
we just checked the wiring and everything looked fine on that end. We still have our problem of these insane iteration count numbers despite the motor not even turning, any idea on troubleshooting? We implemented it as a counter do you think the dio polarity could be the issue (just throwing out ideas)?