How can I send .cy coordinate of my object via UART?

I want to send the aril.cy via UART with my pass or fail functions. This is what I have so far

import sensor, image, time, math

from pyb import UART, ADC
import ulab
from ulab import numpy

sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
#sensor.set_auto_gain(False) # must be turned off for color tracking
#sensor.set_auto_whitebal(False) # must be turned off for color tracking

threshold_seed = (7,24,-8,4,-3,9)
threshold_aril = (62,76,-20,-9,58,72)
threshold_raphe = (36,45,28,43,17,34)
thresholds = [threshold_seed,threshold_aril,threshold_raphe]

clock = time.clock() # Create a clock object to track the FPS.

uart = UART(1, 9600)
uart.init(9600, bits=8, parity=None, stop=1)

limitLoop = 0

########################################################
#FUNCTIONS
#global seed
#global aril

def func_position(arilY):
aril.cy = bytes(8)

def func_pass():

                       #create a variable out of results from count function to print and coomunicate
result = "P"

print(result)
print(str(arilY))
uart.write(str(arilY))
uart.write(result)

                                #these two functions print info to serial monitor and send
                                #to arduino the count & either Pass/Fail

def func_fail():

result = "F"

print(result)
uart.write(str(arilY))
print(str(arilY))
uart.write(result)

def func_orientation(arilX,seedX):
check = 0
check = (seedX - arilX)
if (check > 0) :
func_pass()

else:

    func_fail()

def func_ackee(Code,seedY,arilY):

if Code == 7:  #if all three detectcted, focus on aril and draw rect

    for seed in img.find_blobs([threshold_seed],pixels_threshold=200,area_threshold=200, merge=True):
        img.draw_rectangle(seed[0:4])
        img.draw_cross(seed.cx(),seed.cy())
        img.draw_string(seed.x()+2,seed.y()+2,"seed")
        seedY = seed.y()

    for aril in img.find_blobs([threshold_aril],pixels_threshold=600,area_threshold=600, merge=True):
        img.draw_rectangle(aril[0:4])
        img.draw_cross(aril.cx(),aril.cy())
        img.draw_string(aril.x()+2,aril.y()+2,"aril")
        arilY = aril.y()

    func_orientation(seedY,arilY);

    func_position()



if Code == 3:

else :

#"bad ackee" designation, all three components not
# detectced. Automatic fail. Iterate countFail
    for seed in img.find_blobs([threshold_seed],pixels_threshold=200,area_threshold=200, merge=True):
        img.draw_rectangle(seed[0:4])
        img.draw_cross(seed.cx(),seed.cy())
        img.draw_string(seed.x()+2,seed.y()+2,"seed")
        seedY = seed.y()

    for aril in img.find_blobs([threshold_aril],pixels_threshold=600,area_threshold=600, merge=True):
        img.draw_rectangle(aril[0:4])
        img.draw_cross(aril.cx(),aril.cy())
        img.draw_string(aril.x()+2,aril.y()+2,"aril")
        #global arilY
        arilY = aril.y()

    func_position()

    func_fail()

########################################################

while(True):
clock.tick() # Update the FPS clock.
img = sensor.snapshot() # Take a picture and return the image. also where the terminal directs you when it crashes.

#initialize
Code = 0
ackee = False
seedY = 0
arilY = 0



for ackee in img.find_blobs(thresholds,pixels_threshold=200,area_threshold=200,merge=True):
    Code = 7

func_ackee(Code,seedY, arilY)

Hi, you need to use the struct module to serialize the data into a byte stream or print the value as a string.

This is a generic python issue. You can find the answer for how to do this online.