Couple questions about the H7

Sending via json is the best method. Note that the str() representation of all OpenMV objects is valid json. You should just send json output and then decide that received json in the other program.

Thnkas for the fast reply but i managed to figure out something just after posting ! Actually sometimes the cam send some kind of bugged datas like “[9” and nothing after or just "]’ so in my receiver program i just made :

 time.sleep(0.2)
            data = sp.read(sp.inWaiting()).decode('utf-8') 
            if len(tuple(data))>=5:
                data= json.loads(data)
                print(data[0])
                sys.stdout.flush()

NOTE: the time.sleep(0.2) is also in the cam micro python program, if those datas are different the json.loads will send an error.

If you are getting weird bugs like that it’s a programming error on the camera. The last user who had an issue like that was referencing objects that had gone out of scope and we’re being garbage collected. I noticed you just do a general read all command on the PC side which isn’t really the most robust thing to do.

What do you mean by a general reading on the PC side (sorry i’m new to computing, i’ve been doing it for a year or a bit less maybe i have dumb questions )

The code on the PC side to read data doesn’t have any concept of data framing. It just grabs whatever data has been received and then processes that. Which means you have no idea how many packets you grabbed in one go and etc. So, when you are trying to parse the data you have no idea what’s at the head of the buffer or etc.

If you want to make the data transfer better you’d compute the length of bytes to send on the H7 side, send that length count which is of a fixed size. Then the PC side receives that length, and the reads the data count expected afterwards.