Sending image centroid coordinates to Arduino for further processing

Hello,
The project I am working on requires me to recognise a certain colour using the OpenMV camera, get the centroidal coordinates and send this data to an Arduino to further control 4 stepper motors, which will move a body to the location of the colour detected. Right now, I have managed to get the coordinates and send it to the Arduino as integers, but I don’t think the process is working because the serial monitor is displaying a lot of garbage values along with the coordinates. (picture below)

The connections:
Arduino TX to OpenMV P4
Arduino RX to OpenMV P5
Gnd to Gnd

The OpenMV and arduino uno codes are as below:

OpenMV:

import sensor, image, time
import time
from pyb import UART
uart = UART(3,9600, timeout_char = 1000)

threshold_index = 0 # 0 for red, 1 for green, 2 for blue
thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
              (30, 100, -64, -8, -32, 32), # generic_green_thresholds
              (0, 30, 0, 64, -128, 0)] # generic_blue_thresholds

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking
sensor.set_auto_whitebal(False) # must be turned off for color tracking
clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot()
    for blob in img.find_blobs([thresholds[threshold_index]], pixels_threshold=200, area_threshold=200, merge=True):
        img.draw_rectangle(blob.rect())
        img.draw_cross(blob.cx(), blob.cy())
        uart.write("%d\n"%blob.cx())
        uart.write("%d\n"%blob.cy())
        print("x=%d\n"%blob.cx())
        print("y=%d\n"%blob.cy())

Arduino uno:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1); // RX, TX

void getline(int *buffer, int max_len)
{
  uint8_t idx = 0;
  char c;
  do
  {
    if(idx >= max_len) return;
    while (mySerial.available() == 0); 
    c = mySerial.read();
    int coordinate = c - '0';
    buffer[idx++] = coordinate;
  }
  while (c != '\n' && c != '\r'); 
  if(idx >= max_len) return;
  buffer[idx] = 0;
}

void setup() {
Serial.begin(9600);
mySerial.begin(9600); 
}

void loop(){
  int buffer [63+1];
  int max_len = 63;
  getline(buffer, max_len);
  for(int i = 0; i < 64; i++)
  {
    Serial.println(buffer[i]);
  }
}

If I leave the coordinates as a string, then I get the correct output on the serial monitor, but I need to convert it to integer in order to control the stepper motors. Any help on this would be greatly appreciated!

Move the software serial to pins other than 0/1. Those are what the hardware serial monitor uses to send debug info to the PC. The Arduino only has 1 serial port. Software serial allows you to create another serial port on other pins.