   }
   Serial.println(AndroidMessage);
 }
+

  // so don't use those in your messages!
  _byte_pos = 0;
  memset(AndroidMessage, 0, sizeof(AndroidMessage));
  
  // lock on sync (0xa5)
  for (int i=0; i < sizeof(_syncPeaksCyclic) / sizeof(int); ++i) {
    _syncPeaksCyclic[i] = _getNextAudioPeak(-1);

int _byte_pos;

int _getNextAudioPeak(int timeout) {
  // look for peaks in audio signal once sample exceeds PEAK_DETECT_THRESH
  // return peak after sample falls under CYCLE_RESET_THRESH
  int sample, peak, no_sig_length;

  no_sig_length = 0;
  sample = analogRead(A0);
  while(sample <= PEAK_DETECT_THRESH) {
    if ((timeout > 0) && (no_sig_length > timeout)) {
      return 0;
    }
    ++no_sig_length;
    sample = analogRead(A0);
  }
  peak = sample;

  while (sample >= CYCLE_RESET_THRESH) {
    if (sample > peak) {
      peak = sample;
    }
    sample = analogRead(A0);
  }

  return peak;
}

int _isInSync() {
  // look for a 0xA5 pattern in incoming audio peaks
  static int diffsign[SYNC_PEAKS-1] = { 
    +1, -1, -1, +1, +1, -1, -1, +1, -1, +1, +1, -1, -1, +1, +1  };
  for (int i=0; i < SYNC_PEAKS-1; ++i) {
    int diff = _syncPeaksCyclic[(_syncHead + i + 1) % SYNC_PEAKS] - _syncPeaksCyclic[(_syncHead + i) % SYNC_PEAKS];
    if (diff * diffsign[i] < 0) {
      return 0;
    }
