 /************************************ INCLUDED LIBS & HEADERS ***********************************************/
 #include "avr/pgmspace.h"
 #include <UTFT.h>
+#include <Encoder.h>
+/************************************ DEFINITIONS ***********************************************************/
+#define DEBUG 1
 
-/************************************ DEFINITIONS ***********************************************************/
-#define DEBUG 0
 #define WIDTH 480
 #define HEIGHT 320
 // SEQUENCER

  // LCD 
  drawCircFrame();
  printBPM();
  printSteps();
}

/************************************ SEQUENCER FUNCTIONS ***************************************************/

}

void printDur(){
  lcd.setColor(VGA_BLUE);
  lcd.printNumI(stepEdit, 64, HEIGHT-18);
  lcd.print("-", 80, HEIGHT-18);
  lcd.printNumI(dur[stepEdit], 96, HEIGHT-18);
}
/************************************** UPDATE CONTROLS *****************************************************/
void updateControls(){
  // Potentiometers
  bpm = (analogRead(BPMPIN) >> 3) + 30; // from 30 to 157 bpm
  numSteps = (analogRead(NSTEPSPIN) >> 7) + 1; // from 1 to 8 steps 
  
  
  // Encoder 
  button = digitalRead(ENCB);
  if(button < 1 && button != _button){
    stepEdit++;
    if(stepEdit > numSteps) stepEdit = 1; 
  } 
  _button = button;
  
  encVal = encoder.read() >> 2;
  if (encVal > _encVal){ 
    dur[stepEdit]+=2;
    if(dur[stepEdit] > 99) dur[stepEdit] = 0;
  }
  if(encVal < _encVal){
    dur[stepEdit]-=2;
    if(dur[stepEdit] < 0) dur[stepEdit] = 99;
  }
  _encVal = encVal;

}



