problem with make Smart card based on Arduino uno

Hello

i am new in arduino and i have problem with

make Smart card based on Arduino uno

if any one help me

for start i have use this source

https://github.com/metalamin/KITT-Cat

it work with me it send ATR work fine

my problem

i want to add to this source if when i got data from RX i show it in HEX format

like here

if (mySerial.available()){
Serial.write(mySerial.read());
}

my code is

#include <SoftwareSerialPar.h>

#define ledPin 13 // LED 
#define dataPin 8 // to IO pin
#define resetPin 2 // to Reset pin

SoftwareSerialPar mySerial(dataPin, dataPin); // same pin for RX and TX

const int bufferSize = 60;
int cardSpeed = 9600;      // Initial speed = Frecuency / 372 in the case for a 4Mhz reader
int interByteDelay = 200;   // Inter byte delay in microseconds
byte data[bufferSize];
int dataSize;

static byte ATR[18] = { 0x3B,0x30,0x90,0x10,0x50,0x82,0x60,0x18 };

void reset_change(){
  delay(500);
  pinMode(dataPin, OUTPUT);
  PutBytes(ATR,sizeof(ATR));
  pinMode(dataPin, INPUT_PULLUP);
}

void PutBytes(byte data[],int n){
  pinMode(dataPin, OUTPUT);
  for(uint16_t i=0; i < n; i++) {
    delayMicroseconds(interByteDelay);
    mySerial.write(data[i]);
  } 
  pinMode(dataPin, INPUT_PULLUP);
}

void setup()
{
  // Open serial communications
  Serial.begin(9600);
  Serial.setTimeout(1); 
  mySerial.begin(cardSpeed); // set the data rate for the SmartCard
  attachInterrupt(digitalPinToInterrupt(resetPin),reset_change,RISING); //Interrupt for the ATR after the RESET
}

void loop() // run over and over
{
  if (mySerial.available()){
   Serial.write(mySerial.read());
  }

  if (Serial.available()){
    pinMode(dataPin, OUTPUT);       //Change the Data pin to OUTPUT mode
    dataSize=Serial.readBytes(data,bufferSize);
    PutBytes(data,dataSize);
    pinMode(dataPin, INPUT_PULLUP); //Change the Data pin to INPUT mode
  }
}

up

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you also take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

You define this as 18 bytes

static byte ATR[18] = { 0x3B,0x30,0x90,0x10,0x50,0x82,0x60,0x18 };

but only put 8 bytes into it. So when you transmit this, you are sending a lot of 0's after that data. Is that what you intended?

PutBytes(ATR,sizeof(ATR));

Why are you setting the serial timeout to 1ms?

  Serial.begin(9600);
  Serial.setTimeout(1);

At 9600 baud, it takes about 1 ms to receive 1 char so you could easily timeout before receiving the next char.

If you want to display the values, use print() rather than write() as it will convert the byte to ascii readable and use the HEX format

  if (mySerial.available()){
   Serial.print(mySerial.read(), HEX);
  }

You might want to print some sort of separator between bytes since if a byte is less than 0x10, it will only print as 1 digit which makes it hard to know what exactly was printed.