SO I removed the stepless encoder out of a behringer controller. I hooked it up to the teensy on digital 2 and 3 with center as ground using the following:

#include <Encoder.h>

Encoder enc_one(2, 3);
int value;

long enc_one_previous = -999;
byte button_previous;

void setup() {
pinMode(23, INPUT_PULLUP);
}



void loop() {
value = enc_one.read();
if(value > 127) { enc_one.write(127); }
else if(value < 0) { enc_one.write(0); }

value = constrain(value, 0, 127);
if (value != enc_one_previous) { enc_one_previous = value; usbMIDI.sendControlChange(1, value, 1); }

value = digitalRead(23);
if(value != button_previous) { button_previous = value; usbMIDI.sendControlChange(2, (1 - value) * 127, 1); delay(3); }
}


The encoder will intermittently send the opposite midi signals (for example move up in browser view ehn it should move down) and jitter... a lot.

Is it something with the code, or with the encoder do you think?