How to Send Hexadecimal value to Serial Devices

mr_hacker90:
is there any other way that so that i can write it simultaneously?

There are three overloaded implementations of Serial.write:

Serial.write(val)
Serial.write(str)
Serial.write(buf, len)

The first one sends a single byte, as johnwasser showed.

The second one sends an array of bytes, stopping when it reaches a null value in the array. (This would usually be used to send null-terminated strings.)
The third one sends an array of bytes with the number of bytes explicitly specified. This one seems to be what you want.

// uncompiled, untested
byte message[] = {0xAA, 0xBB, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03 };

Serial.write(message, sizeof(message));
2 Likes