You are reading a single comment by @tage and its replies. Click here to read the full conversation.
  • > require("Encoder").connect(A1,A5,functio­n (direction) {
      step += direction;
      if (step >=4)
      {
        pos += 1;
        if (pos>96) {
          pos=96;
        }
        step=0;
        print_pos();
      }
      if (step <=-4)
      {
        pos += -1;
        if (pos<20) {
          pos=20;
        }
        step=0;
        print_pos();
      }
      });
    

    this is my workaround for getting one count per click (probably there is a more elegant way - I am new to javascript..)
    the encoders I have are the cheapest kind, but used in this way it does not seem to be any difference if I have RC filters to handle debounce or not. good to know that debouncing will be introduced in the code later on.

About

Avatar for tage @tage started