OK, it sounded too cheap for optical encoder and I do not have interest nor time reading 20 plus pages of doc. Sorry to mislead you.
But it is Gray encoder and as such it can produce code which has ONE and ONLY one state after a change is detected and checking for bounce is IMHO not the way to verify the code.
For example when A channel goes high than the B channel state should be checked immediately.
If A bounces ( low / high ) and is rechecked as high again - the code is no longer valid Gray code because only OPPOSITE channel
can change next and into specific level - depending on encoder rotation (CW/CCW).
because only OPPOSITE channel can change next and into specific level
Wrong.
The same channel changes again first on a reversal of direction, and this is why encoder switch bounce is read as a reversal of direction. If you are at count 0 and you move the encoder through one quadrature transition (one pin changing state) and expect to see a count of +1, you will see count output like 1,0,1,0,1,1,1,1 on a bouncy mechanical encoder as it stabilizes.
Paul__B:
PHPirates:
This is the breadboard layout:I see a problem immediately!
You have indicated that your stepper and ULN2003 are taking power from the 5V terminal on the Arduino. You will be in for a world of pain!
You need a separate power supply for the stepper, one capable of providing the necessary current.
I do? I thought of that too, but from this website, which uses about the same type of stepper and driver, doesn't use an additional power source, so that's why I didn't too.
I already ran code to try out the stepper, and that worked fine.
Googling from your post I get to the arduino website where they indeed recommend a power supply for the stepper.
So, can I just pull the current from the wall and wire it like in the example? I'm now trying to find proper wiring here...
PS Vaclav, if you don't take the time to read where this topic is about, you are not going to be able to help me much.
I am sorry that I was unable to help you. This is way out of my limited field of experience.
Have a nice day,