#define START_FRAME 0xABCD // [-] Start frme definition for reliable serial communication #include SoftwareSerial HSerial(2,3); // RX, TX typedef struct{ uint16_t start; int16_t steer; int16_t speed; uint16_t checksum; } SerialCommand; SerialCommand Command; void Send(int16_t uSteer, int16_t uSpeed) { // Create command Command.start = (uint16_t)START_FRAME; Command.steer = (int16_t)uSteer; Command.speed = (int16_t)uSpeed; Command.checksum = (uint16_t)(Command.start ^ Command.steer ^ Command.speed); // Write to Serial HSerial.write((uint8_t *) &Command, sizeof(Command)); }