Bike interface OBD

Hi, i updated the timestamp section which was wrong, now it works..

#define WB 0
#define TX 14
#define console Serial
#define c_baud 115200
#define sds Serial3
#define sds_baud 10400
#define LED 9
#include <SD.h>

// Konstant Values
boolean const debug = 1;
boolean const wideband = true;
int const send_delay = 1;
int const wait_before_ = 6000;
int const fast_init_delay = 25;
int const recive_send_delay = 43;
int const timeout = 150;
int const chipSelect = 53;
byte const dataSequence[2][7] = {
  {
    0x81, 0x12, 0xF1, 0x81, 0x05    }
  ,
  {
    0x80, 0x12, 0xF1, 0x02, 0x21, 0x08, 0xAE    }
  ,
};
int const dataSize[2] = {
  5,7};

// Dynamic
boolean loging = false;
boolean startup = false;
int mode = 0;
int datalenght = 0;
String datarec_csv = "";
String datarec_bin = "";
unsigned long lasttime = 0;
unsigned long cycletime = 0;
word milliseconds = 0;
byte seconds = 0;
byte minutes = 0;
byte hours = 0;
byte days = 0;
int afr = 0;
byte inByte[99] = {
};

void setup() {
  pinMode(LED, OUTPUT); 
  console.begin(c_baud);
  if (debug >= 1) console.print("Initializing SD card...");
  pinMode(chipSelect, OUTPUT);   
  pinMode(10, OUTPUT); 
  if (!SD.begin(chipSelect)) {
    if (debug >= 1) console.println("Card failed, or not present");
    return;
  }
  if (debug >= 1) console.println("card initialized.");
  loging = true;
}

void loop() {
  fastinit();
  talkserial();
  if (mode) {
    read_wideband();
    timestamp();
    createString();
    writetosd();
    while (console.available()) {
      console.read();
      startup = false;
      mode = false;
    }
  }
}

void fastinit(){
  if (!startup) {
    mode = 0;
    milliseconds = 0;
    seconds = 0;
    minutes = 0;
    hours = 0;
    days = 0;
    afr = 0;
    while(sds.available()) {
      sds.read();
    }
    sds.end();
    pinMode(TX, OUTPUT);
    if (debug >= 1) console.println("Starting comunication (fastinit)");
    digitalWrite (TX, HIGH);                                       
    if (debug >= 1) console.println("Set K-Line High");
    delay(wait_before_);                                                              
    digitalWrite (TX, LOW);                                                    
    if (debug >= 1) console.println("Set K-Line Low");
    delay(fast_init_delay);
    digitalWrite (TX, HIGH);                                                      
    if (debug >= 1) console.println("Set K-Line High");
    delay(fast_init_delay);    
    sds.begin(sds_baud);                                                      
    if (debug >= 1) console.print("Starting Serial Comunication @ ");
    if (debug >= 1) console.println(sds_baud);
    startup++;
  }
}

void talkserial() {
  datalenght = 0;
  unsigned long time = millis();
  unsigned long timediff = millis();

  while (time < cycletime+recive_send_delay) {
    if (debug >= 2) console.println("waiting");
    time = millis();
  }
  if (debug >= 2) console.println("sending some bytes...");
  for (int x = 0;x < dataSize[mode];x++) {
    sds.write(dataSequence[mode][x]);
    if (debug >= 2) {
      if (dataSequence[mode][x] < 0x10) {
        console.print("0");
      }
      console.print(dataSequence[mode][x],HEX);
    }
    delay (send_delay);
  }
  if (debug >= 2) console.println("recieving some bytes...");
  while (startup) {
    time = millis();
    if (time-timediff > timeout) {
      startup = 0;
      mode = 0;
      break;
    }
    if (sds.available()) {
      inByte[datalenght] = sds.read();
      if (debug >= 2) {
        if (inByte[datalenght] < 0x10) {
          console.print("0");
        }
        console.print(inByte[datalenght],HEX);
        console.print(",");
      }
      if (datalenght == dataSize[mode]+0x04+inByte[0x03+dataSize[mode]]) {
        cycletime = millis();
        if (!mode) mode++;
        break;
      }
      datalenght++;
    }
    digitalWrite(LED, HIGH);
  }
  digitalWrite(LED, LOW);
}

void read_wideband() {
  if (debug >= 2) console.println("reading analog Inputs");
  afr = analogRead(WB);
  if (debug >= 2) console.println(afr,HEX);
}

void timestamp() {
  unsigned long time = millis();
  if (!lasttime) lasttime = millis();
  unsigned long timediff = time - lasttime;
  lasttime = millis();
  milliseconds = milliseconds + timediff;
  if (milliseconds > 999) {
    int multi = milliseconds/1000;
    milliseconds =  milliseconds - multi*1000;
    seconds++;
  }
  if (seconds >= 0x3C) {
    seconds = 0;
    minutes++;
  }
  if (minutes >= 0x3C) {
    minutes = 0;
    hours++;
  }
  if (hours >= 0x3C) {
    hours = 0;
    days++;
  }
  if (debug >= 2) {
    console.println("create Time String");
    if (days < 0x10) {
      console.print("0");
    }
    console.print(days,HEX);
    console.print(":");
    if (hours < 0x10) {
      console.print("0");
    }
    console.print(hours,HEX);
    console.print(":");
    if (minutes < 0x10) {
      console.print("0");
    }
    console.print(minutes,HEX);
    console.print(":");
    if (seconds < 0x10) {
      console.print("0");
    }
    console.print(seconds,HEX);
    console.print(":");
    if (milliseconds < 10) {
      console.print("0");
    }
    if (milliseconds < 100) {
      console.print("0");
    }
    if (milliseconds < 1000) {
      console.print("0");
    }
    console.println(milliseconds);
  }
}



void createString() {
  if (debug >= 2) console.println("Create Datastring");
  datarec_csv = "";
  datarec_bin = "";

  if (days < 10) {
    datarec_csv += 0;
  }
  datarec_csv += days;
  datarec_csv += ":";
  if (hours < 10) {
    datarec_csv += 0;
  }
  datarec_csv += hours;
  datarec_csv += ":";
  if (minutes < 10) {
    datarec_csv += 0;
  }
  datarec_csv += minutes;
  datarec_csv += ":";
  if (seconds < 10) {
    datarec_csv += 0;
  }
  datarec_csv += seconds;
  datarec_csv += ":";
  if (milliseconds < 10) {
    datarec_csv += 0;
  }
  if (milliseconds < 100) {
    datarec_csv += 0;
  }
  datarec_csv += milliseconds;
  datarec_csv += ",";

  if (afr < 10) {
    datarec_csv += 0;
  }
  if (afr < 100) {
    datarec_csv += 0;
  }
  if (afr < 1000) {
    datarec_csv += 0;
  }
  datarec_csv += afr;  //AIR FUEL RATIO - From analog Pin 0
  datarec_csv += ",";
  /*
  
   /// remember HEX to DEC conversion forex. 0x14 = 20 starting from 0!!!!
   
   datarec_csv += inByte[dataSize[mode]+0x20];  //TPS
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x21];  //IAP
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x22];  //ECT
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x23];  //IAT
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x26];  //GEAR
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x47];  //STP
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x53];  //CLUTCH
   datarec_csv += ",";
   
   datarec_csv += inByte[dataSize[mode]+0x54];  //NEUTRAL
   datarec_csv += ",";
   */
  datarec_bin += days;
  datarec_bin += hours;
  datarec_bin += minutes;
  datarec_bin += seconds;
  datarec_bin += milliseconds;

  for (int i = 0; i <= datalenght; i++) {
    datarec_bin += inByte[i];
  }
  for (int i = 0; i <= datalenght; i++) {
    datarec_csv += inByte[i];
    datarec_csv += ",";
  }
  if (debug == 1) {
    console.println(datarec_csv);
 //   console.println(datarec_bin);
  }
}

void writetosd() {
  if (loging) {
    if (debug >= 2) console.println("Start opening SD");
    File dataFile = SD.open("LOG.csv", FILE_WRITE);
    if (dataFile) {
      if (debug >= 1) console.println("Writing to LOG.csv");
      dataFile.println(datarec_csv);
      dataFile.close();
    }
    else {
      if (debug >= 1) console.println("error opening LOG.csv");
      loging = false;
    }
  }
}

But i have a question..
How can i create a sting whit hex values and print than on file as binary or maybee print that directly to bin whitout converting it to string? for ex..i have 0x00 0x00 0x01 0x01 0x01 0x02 0x02 0x80 0x12 0xF1... i want to print as bin to logfile and create a string like 0:0:1:1:122,80,12,F1...