I’ve got two encoders (not the ones attached to the motors) on the back wheels of my robot (I’ve NEVER used these before). As I understand it, the encoder is a digital sensor, as it returns a string of ones and zeros to the microcontroller.
The question is this:
Where should I plug the encoders into my cortex? Thanks in advance for any help.
Yes, you are correct in the a digital sensor is a sensor that can only return values of 1 or 0. And that’s exactly what the encoders do. The only thing going back to the microcontroller is a string of 1s and 0s every time the infrared stream is interrupted by the wheel inside the sensor (look at the wiki on how the encoders work). The microcontroller uses this series of 1s and 0s to create an integer value.
I believe that the encoders are analog. They return values anywhere from 1 to however far you want them to go which can be any value depending on the variable you use. EasyC will let you plug them into any port you want, you just have to select what ports you want to use.
They can be plugged into any digital port configured to be an input, one of which will act as an interrupt. You just select the ports you used in the encoder block. It doesn’t matter which one you say is the interrupt, that will just affect your start (whether it is inverted or not) so you will have to test the values you are recieving, I recomend using print to screens.
… by the way are you using cortex or pic?