wokwi-docs: Description and example code for KY-040 encoder does not reflect operation of actual device
Re this page:
https://docs.wokwi.com/parts/wokwi-ky-040
Is it your intent that the simulation of the KY-040 exactly match the behavior of the actual device? If that is the intent, then both the description (in the Operation section) and the associated example code (first example under Reading the rotation) are incorrect: The stated description does not reflect the behavior of the actual device, and the associated example code will not work correctly on the actual device.
I would be happy to provide a pull request with corrections that bring the description and the code into agreement with actual device behavior, but first wanted to ask whether it is even your intent that the simulation match the actual device behavior. Perhaps your intent is only that the simulation behave in a functionally similar way, but not mimic the device exactly…?
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 16 (8 by maintainers)
That actually looks like it may be an EC-11 rather than a KY-040, but it’s hard to tell, they do look similar.
The EC-11’s I’ve got operate like the KY-040’s as well. Here’s a datasheet for the Alps line of EC-11s:
See the timing diagram at the top of p. 7. That diagram explicitly defines what they mean by “stable detent position”, and it makes clear that the operation I refer to above as “detent movement” (i.e. moving from one stable detent position to an adjacent stable detent position) results in a toggle of both lines, not a “return to HIGH” or “return to LOW”.