 #include <arduino2.h>
 
-#define c_EncoderPinA A0
-#define c_EncoderPinB A1
-#define c_EncoderPinZ A2
+#define c_EncoderPinA A1
+#define c_EncoderPinB A2
+#define c_EncoderPinZ A0
 
 #define d_EncoderPinZ 2
 #define d_EncoderPinA 3

#define d_EncoderInterruptA 1

volatile bool _EncoderBSet;
volatile long _EncoderTicks = 0;
long _last = 0;
double _speed = 0;
long _CentreCount = 0;

 
  // and adjust counter + if A leads B
    _EncoderTicks += _EncoderBSet ? -1 : +1;
}

char *int2str( int num ) {
    static char retnum[11];       // Enough for 20 digits plus NUL from a 64-bit uint.
    sprintf( retnum, "%l", num );
    return retnum;
}

void send_ticks ()
{
  // get access to the float as a byte-array:
  byte * data = (byte *) &_EncoderTicks; 
  // write the data to the serial
  Serial.write (data, 2);
  //_EncoderTicks++;
}

