rotary encoder only works on channel 0
Posted: Sun Oct 15, 2017 2:19 pm
I've got two rotary encoders wired to a Wemos D1 mini, but only the one attached to rotary channel 0 works. If I swap assignments so that the pins associated with the first rotary encoder go to channel 1 and the second rotary encoder goes to channel 0, then the second rotary encoder is the only one that works. This is demonstrated in the commented-out lines below. I can only get one of the two encoders working, but either will work if it is the one that gets assigned to channel 0. This makes me think that my hardware setup is not the problem.
I'm hesitant to assume a bug in the module, but I'm having a hard time seeing what else could be going on. I've tried using the dev branch, flashing with integer vs float, changing the order in which I call setup() and on() -- no dice.
Has anyone else run into this? I'm also seeing some unstable system behavior, but am chalking that up to static discharge reaching the RST pin (for now).
Code: Select all
function rotary_status(type, pos, when)
print("0 / Position=" .. pos .. " event type=" .. type .. " time=" .. when)
end
function rotary_setup()
--rotary.setup(0, 5, 6, 3)
--rotary.setup(1, 1, 2, 7)
rotary.setup(0, 1, 2, 7)
rotary.setup(1, 5, 6, 3)
rotary.on(0, rotary.ALL, rotary_status)
rotary.on(1, rotary.ALL, rotary_status)
print("# rotary setup complete")
end
I'm hesitant to assume a bug in the module, but I'm having a hard time seeing what else could be going on. I've tried using the dev branch, flashing with integer vs float, changing the order in which I call setup() and on() -- no dice.
Has anyone else run into this? I'm also seeing some unstable system behavior, but am chalking that up to static discharge reaching the RST pin (for now).