Thanks for the PR!
This is the first one I found when I just googled for rotary encoder: http://uk.rs-online.com/web/p/products/7377767/
rotary encoder
I think it's like the one I have.
It'd be great if you could look at it - your code was much tidier! Perhaps (to be backwards compatible) we could have:
// original behviour require("Encoder").connect(A1,A2,function (direction) { ... }); // your behaviour require("Encoder").connect(A1,A2,{clicks:2, callback:function (direction) { ... }}); // other behaviour require("Encoder").connect(A1,A2,{clicks:4, callback:function (direction) { ... }});
Of course there might be a better name for it, but allowing the function to be changed to an object with extra parameters would be really good.
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks for the PR!
This is the first one I found when I just googled for
rotary encoder
: http://uk.rs-online.com/web/p/products/7377767/I think it's like the one I have.
It'd be great if you could look at it - your code was much tidier! Perhaps (to be backwards compatible) we could have:
Of course there might be a better name for it, but allowing the function to be changed to an object with extra parameters would be really good.