 
   Last updated by Jeff Hoefs: April 11, 2015
         Alan Yorinks August 5, 2015
+        David Fisher Oct 2, 2015
 */
 
 #include <Servo.h>

/* Rotary Encoder Support */
byte  encoderMSBLeft, encoderLSBLeft,  encoderMSBRight, encoderLSBRight;     // sysex data registers
uint8_t encoderPin1, encoderPin2 ; // user specified encoder pins
//int encoderPostion = 0;            // current position of encoder
//int8_t clicks = 0 ;                // encoder click counter
boolean encoderPresent = false ;   // encoder installed flag

volatile uint16_t interruptCountLeft = 0; // The count will go back to 0 after hitting 65535.
volatile uint16_t interruptCountRight = 0; // The count will go back to 0 after hitting 65535.


// encoder reporting variables
int encoderNumLoops = 5; // number of loops to complete before reporting encoder counts
int encoderLoopCounter = 0;

// encoder counts detected via interrupt
void interruptFunctionLeft() {

  Firmata.sendSysex(SYSEX_I2C_REPLY, numBytes + 2, i2cRxData);
}


void outputPort(byte portNumber, byte portValue, byte forceSend) {
  // pins not configured as INPUT are cleared to zeros
  portValue = portValue & portConfigInputs[portNumber];
  // only send if the value is different than previously sent
