Serial protocol for motor control with arduino and cpp

Hi all,

I need to interface my arduino board and my laptop to communicate together. I want some messages going from the arduino to the pc, and other going from the pc to arduino. Does anyone have a suggestion on how to implement a protocol?

example: from the arduino i want to send the position of N motors and I need to read them on the pc using cpp

example2: the pc sends a message to the arduino with the reference position of motor X.

How should I implement functions that allow this exchange of information? Anyone have suggestion or tutorials or code?

thanks :)

Serial

You are looking for UART serial communication.