16 bit serial communication arduino mega 2560

i want to transmit 16 bits from one arduino to another via IR transmitter i know how to transmit 8 bits but have no idea for 16 bits .

send it as two 8 bit bytes and then re assemble it at the receiving end

using a uint 16 and add the first byte in then bit shifting the second byte and or-ing it with the first byte into the 16 bit unint

Cheers Pete.

Arduino Reference
•lowByte()
•highByte()

Bainesbunch:
send it as two 8 bit bytes and then re assemble it at the receiving end

using a uint 16 and add the first byte in then bit shifting the second byte and or-ing it with the first byte into the 16 bit unint

Cheers Pete.

If you can provide me a sample code because i could find one

Waleed_Ahmed_Khan:

Bainesbunch:
send it as two 8 bit bytes and then re assemble it at the receiving end

using a uint 16 and add the first byte in then bit shifting the second byte and or-ing it with the first byte into the 16 bit unint

Cheers Pete.

If you can provide me a sample code because i could find one

look what a simple Google search reveals

Hope this helps.

Cheers Pete.