 
 // DRO.ino
+//#define ENCODER_OPTIMIZE_INTERRUPTS
+#include <Encoder.h>
 
 #include "utility/twi.h"
 #include "Wire.h"
 
 #include "LCDSmoothiePanel.h"
 
+
+
 #define LE_ENCA 2
 #define LE_ENCB 3
+
+Encoder lme(LE_ENCA, LE_ENCB);
 
 int readEncoderDelta(char &old_AB)
 {

    // }
    // Wire.endTransmission();

    pos += readEncoderDelta(enc1);
    if(pos != lastpos && millis() > lt1) {
        //Serial.println(pos);
        //lcd_setCursor(0, 1);

        lcd_setCursor(0, 2);
        lcd_printf("%5ld.%04ld mm", p/1000, abs(p%1000));
        lastpos = pos;
        lt1 = millis() + 100;
    }

    if(millis() > lt2) {
        // read buttons
        uint8_t b= lcd_readButtons();
        if(b & BUTTON_LEFT) {
            //pos= 0;
            lme.write(0);
        }
        lt2= millis() + 200;
    }
