Decoding stream containing hex-values received on Serial port.

Hi. I see that i expressed myself wrong. I am not sending data to a printer with the Arduino.

I have the printer mechanics from a dead Brother P-touch label printer (PT-2500PC). The electronics is defunct and close source. I made some new electronics that can drive the stepper, DC-motor and printhead. This is connected to my Arduino.

I am /not/ in control of how my received data looks like. I simply make a new image in software like GIMP/Paint/Whatever and save it as an BMP, or what might be simpler to use, XBM.

The plan was to simply open up a serial terminal emulator on the computer and send the image file off as an textfile. Then it would be transmitted byte-for-byte for the Arduino to interpret.

The code i am using to send data off to the printhead is this. It behaves like a shift register.

void sendBytes(byte bits) {

 for (int i = 0; i < 16; i++)
 {
   shiftOut(DATA, CLOCK, MSBFIRST, bits);
 }
 digitalWrite(LATCH, LOW);
 digitalWrite(LATCH, HIGH);

 delay(1);
 digitalWrite(STROBE, LOW);
 delayMicroseconds(2000);
 digitalWrite(STROBE, HIGH);
}

And here's how the printhead works, electrically:

Does it make any more sense now?