Remove function for "HEX" format on monitoring

Hello ,

In a specific rfid program, I would like to remove undesired bytes sent from my reader.

After read arduino reference, i used the "remove" function ,for delete the indesirables bytes incomed from my serial port .

For use "remove" function I needed to use "string "function and "readString" function .

In ascii ,it working fine, particularly when I receive the version of the reader in ASCII format.

void monitoring_asc ()

{
 
  ss.listen();                // Listen is frames presents 
  
  delay(200);                 // let a delay of 200 ms before reading

   
  while(ss.available() >0)   //  
  {
    
 String inbyte = ss.readString(); // Use string function 
 
 inbyte.remove(2,1);              // Remove at position 2 of the frame one byte       
 inbyte.remove(14,2);             // Remove at position 14 of the frame two bytes
 
 Serial.print(inbyte); // Print the result on serial monitor  
 
 delay(50);                  // Let a delay between frame 
  }
}

But when I would like to read the tag ID number ,in Hex format ,nothing working ,

I 'm tryed to change "print" by "write" ,change the format of monitoring with ", HEX", after my desired printed variable "inbyte".

And nothing accepted due to the "String" function used.

To be honnest ,I use and rebuilt this serial function ,found on a web thread ...

In a specific rfid program, I would like to remove undesired bytes sent from my reader.

The easiest way to do that is to avoid use of unreliable Strings, and read all the bytes into a C-string, a zero terminated character array.

A C-string can be modified by the many simple and reliable functions in the C-string library.

It's my understanding that most (or all) RFID readers communicate binary data, not text. If that is indeed the case, the use of String is doomed to fail.

Can you show your original code?

PS
forgot to ask for a link to the (specs of) the reader; please provide that as well

In first Sirs ,

Many thanks for your help ,

In first sterretje, the data return converted in ASCII format concern uniquely the version of reader format ,the first fonction ,I was test.

After, all the data from the this reader, are in hex fomat.
Thats works ,but I’m trying to reduce the total data received from a Tag ID .

You have ,the mode ,the type of tag ,the CRC ,and the ID ,I would like to remove few of these frame and display them on the IDE monitor ,before display it on a little oled display.

The reader is Nano US, from Netronix ,it’s a multiprotocol reader .
I let here the sheets .

And my complete code.
Last version

/*
    <> RFID Reading / Writting
    <> Nano-US v10 and Higher
    <> v 0.0.5
  
NEW > Software serial bus use for communication and harware for monitoring
    > L112 or L113 antenna
    > Firmware selecting mode
    > Reading hardware version 
    > Custom shield used 
  
  # Hardware Custom shield pins assignement :
  
    - Mode INTER1 > DO4
           INTER2 > DO5 
           INTER3 > DO6
  
    - Uart Tx > D012 
           Rx > DO11
*/

// ########### Library added ###########

#include <SoftwareSerial.h>           

// ########### Variable ################

// Software serial used 

  SoftwareSerial ss(12, 11);   


void monitoring_asc ()
{
 
  ss.listen();                // Listen is frames presents 
  
  delay(200);                 // let a delay of 200 ms before reading
    
  while(ss.available() >0)   //  
  {
 String inbyte = ss.readString(); // Use string function 
 
 inbyte.remove(2,1);              // Remove at position 2 of the frame one byte       
 inbyte.remove(14,2);             // Remove at position 14 of the frame two bytes
 
 Serial.print(inbyte); // Print the result on serial monitor  
 delay(50);                  // Let a delay between frame 
  }
}  

void monitoring_hex ()
{
 
  ss.listen();                // Listen is frames presents 
  
  delay(200);                 // let a delay of 200 ms before reading
    
  while(ss.available() >0)   //  
  {
   int inbyte = ss.read(); 
// String inbyte = ss.readString(); // Use string function 
 
 //inbyte.remove(2,1);              // Remove at position 2 of the frame one byte       
// inbyte.remove(14,2);             // Remove at position 14 of the frame two bytes
 
 Serial.print(inbyte,HEX); // Print the result on serial monitor  
 delay(50);                  // Let a delay between frame 
  }
}  

void setup()
{
// Serials (Hard and soft) 

  Serial.begin(19200);
  ss.begin(9600);

// Mode (UART mode used here, all Inter at high)
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  
  digitalWrite (4, HIGH);
  digitalWrite (5, HIGH);
  digitalWrite (6, HIGH);

// ********* Command control ********* 

// ########### Show version of module ############# 

// Header   
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length  

// Command 
  ss.write(0xFE);             // Call version command

// CRC(xModem calculation)

  ss.write(0xC6);             // CRCH  
  ss.write(0x14);             // CRCL
  
  monitoring_asc();
  
// ########### Select transponder type ############# 
  
  delay(500);                 // Let a delay of 0,5 s before call a new command     

// Header   
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length  

// Command 
  ss.write(0x02);             // Select transponder type changing
  ss.write(0x03);             // Type unique
  ss.write(0x01);             // With a gain of 0x1
  
// CRC(xModem calculation)

  ss.write(0xE8);             // CRCH  
  ss.write(0x87);             // CRCL
  
  Serial.println();
 
  monitoring_asc();
  
// ########### Turn on antenna ############# 
  
  delay(500);                 // Let a delay of 0,5 s before call a new command     

// Header   
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length  

// Command 
  ss.write(0x10);             // Select transponder type changing
  ss.write(0x01);             // Type unique
  
// CRC(xModem calculation)

  ss.write(0xDA);             // CRCH  
  ss.write(0xF4);             // CRCL
  
  Serial.println();
 
  monitoring_asc();
  
// Header   
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length  

// Command 
  ss.write(0x12);             // Select transponder type changing
  
// CRC(xModem calculation)

  ss.write(0xFA);             // CRCH  
  ss.write(0xB6);             // CRCL
  
  
 
  
  
  delay(1000);                 // Let a delay of 0,5 s before call a new command  
  Serial.println();
  
}


void loop()
{
  // ########### Read transponder ID ############# 
  
  monitoring_hex();
 
  

  delay(500);

}

jremington

“The easiest way to do that is to avoid use of unreliable Strings, and read all the bytes into a C-string, a zero terminated character array.”

I 'm sure you have reason, but it’s why I posted my question in this forum …
Like I explained before ,I kept the little serial communication code from an web thread ,cause I was not arrive to realize a serial communication by myself ,even it’s not my first program .

Possibilities ,thats I copied a bad and unadapted code are great possible .

I thinked this RFID system ,could not be very difficult ,and I realized my error …

Nano - US.pdf (820 KB)

Post some examples of the strings you receive from the reader, and explain what you want to do with them.

The document you attached does not appear to provide any information about the output data.

After, all the data from the this reader, are in hex fomat.

Probably not. Serial input data are always binary, but might contain printable ASCII characters. Those in turn could represent numbers in HEX format, or readable text.

You might be printing the data in HEX format, which is a human readable representation of binary numbers.

Part of the information that we’re looking for is in the Netronix protocol document. Based on that, below a quick attempt. It’s probably not rock solid, but should give you a start. All bytes are stored in an array first.

I’ve removed monitor_asc(). The monitor_hex() function first waits for 2 bytes to arrive. The second byte indicates the length of the frame. Based on your code in setup(), it’s the full length.

Next it reads ss till all bytes are received.

After that, it prints out the received frame (array). The code should show you how you can get to the bytes of interest.

// ########### Library added ###########

#include <SoftwareSerial.h>

// ########### Variable ################
// Software serial used
SoftwareSerial ss(12, 11);

// buffer to store received data; size based on the fact that framelength in the packet can be 255.
byte rawData[255];

void monitoring_hex ()
{
  // where to stare received byte in rawData
  byte index = 0;
  // clear rawData
  memset(rawData, 0, sizeof(rawData));
  // frameLength for convenience
  byte frameLength = 0;
  // received byte on software serial
  byte inbyte;


  ss.listen();                // Listen is frames presents

  delay(200);                 // let a delay of 200 ms before reading

  // we need the frame length so we need to have at least two bytes
  while (ss.available() < 2)
  {
    // wait;
  }

  // read the two bytes (address and frame length)
  inbyte = ss.read();
  Serial.print("inbyte = "); Serial.println(inbyte, HEX); // Print the result on serial monitor
  // store the bytes in rawData array
  rawData[index++] = inbyte;
  inbyte = ss.read();
  Serial.print("inbyte = "); Serial.println(inbyte, HEX);  // store the byte in rawData array
  rawData[index++] = inbyte;

  // convenience
  frameLength = inbyte;

  // read the rest of the message
  while (index < frameLength) //
  {
    // if nothing to read, try again
    if (ss.available() == 0)
    {
      continue;
    }
    inbyte = ss.read();
    Serial.print("inbyte = "); Serial.println(inbyte, HEX);
    
    // store the byte in rawData array
    rawData[index++] = inbyte;
    // if full frame received
    if (index == frameLength)
    {
      break;
    }
  }

  Serial.println();

  Serial.print("address = 0x");
  if (rawData[0] < 0x10)
  {
    Serial.print("0");
  }
  Serial.println(rawData[0], HEX);

  Serial.print("frame length = 0x");
  if (rawData[1] < 0x10)
  {
    Serial.print("0");
  }
  Serial.println(rawData[1], HEX);

  Serial.print("frame length = 0x");
  if (rawData[1] < 0x10)
  {
    Serial.print("0");
  }
  Serial.println(rawData[1], HEX);

  Serial.print("response = 0x");
  if (rawData[2] < 0x10)
  {
    Serial.print("0");
  }
  Serial.println(rawData[2], HEX);

  Serial.println("parameters");
  for (byte cnt = 3; cnt < frameLength - 2 - 1; cnt++)
  {
    Serial.print(cnt);
    Serial.print(" 0x");

    if (rawData[cnt] < 0x10)
    {
      Serial.print("0");
    }
    Serial.print(rawData[cnt], HEX);
    Serial.print(" ");
  }
  Serial.println();

  Serial.print("operation code = 0x");
  if (rawData[frameLength - 2 - 1] < 0x10)
  {
    Serial.print("0");
  }
  Serial.println(rawData[frameLength - 2 - 1], HEX);

  Serial.print("CRC = 0x");
  if (rawData[frameLength - 2] < 0x10)
  {
    Serial.print("0");
  }
  Serial.print(rawData[frameLength - 2], HEX);
  if (rawData[frameLength - 1] < 0x10)
  {
    Serial.print("0");
  }
  Serial.println(rawData[frameLength - 1], HEX);
}

void setup()
{
  // Serials (Hard and soft)

  Serial.begin(19200);
  ss.begin(9600);

  // Mode (UART mode used here, all Inter at high)
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);

  digitalWrite (4, HIGH);
  digitalWrite (5, HIGH);
  digitalWrite (6, HIGH);

  // ********* Command control *********

  // ########### Show version of module #############

  // Header
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length

  // Command
  ss.write(0xFE);             // Call version command

  // CRC(xModem calculation)
  ss.write(0xC6);             // CRCH
  ss.write(0x14);             // CRCL

  monitoring_hex();

  // ########### Select transponder type #############

  delay(500);                 // Let a delay of 0,5 s before call a new command

  // Header
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length

  // Command
  ss.write(0x02);             // Select transponder type changing
  ss.write(0x03);             // Type unique
  ss.write(0x01);             // With a gain of 0x1

  // CRC(xModem calculation)

  ss.write(0xE8);             // CRCH
  ss.write(0x87);             // CRCL

  Serial.println();

  monitoring_hex();

  // ########### Turn on antenna #############

  delay(500);                 // Let a delay of 0,5 s before call a new command

  // Header
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length

  // Command
  ss.write(0x10);             // Select transponder type changing
  ss.write(0x01);             // Type unique

  // CRC(xModem calculation)

  ss.write(0xDA);             // CRCH
  ss.write(0xF4);             // CRCL

  Serial.println();

  monitoring_hex();

  // Header
  ss.write(0x01);             // Module adress ,default is 1
  ss.write(0x05);             // Frame length

  // Command
  ss.write(0x12);             // Select transponder type changing

  // CRC(xModem calculation)
  ss.write(0xFA);             // CRCH
  ss.write(0xB6);             // CRCL

  delay(1000);                 // Let a delay of 0,5 s before call a new command
  Serial.println();

}


void loop()
{
  // ########### Read transponder ID #############

  monitoring_hex();

  delay(500);
}

Not tested

Hello,

jremington, here that what I arrive to do (joined files ), on Serial monitoring .

I just would like to have (example ID) ,
No filtered : 1C130327E9BAB5FF3FBF
Filtered on display : 0327E9BAB5

After that I would like to compare the received ID to a stored one .

Thats what I would like to do .

Compare.PNG

Hello ,sterretje

In first ,many thanks for your help,

This serial function code is very different from mine, I tested ,it with my system ,
which responding some data on my serial monitoring .

These could be exploited ,and I can start a new version from your sketch .

But I need some time to greatly understand all this function, and mostly if I can reproduce this type of code ,by my own reflexion .

Thats normaly the Arduino principe of learning .

Some electronic module have this type of protocol, without any library ,module which I would like to use, for there particular hardware flexibility.

For sure It's a very big start you gave to me , I did not expect so much !

So much thanks !

Tourneur:
In a specific rfid program, I would like to remove undesired bytes sent from my reader.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

After you have received the complete message it will be simple to extract any part of it that you want and ignore the other parts.

...R

Robin2:
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

After you have received the complete message it will be simple to extract any part of it that you want and ignore the other parts.

It's binary data, not text :wink:

sterretje:
It's binary data, not text :wink:

The stuff in Reply #6 looks like text.

And my code will receive any form of serial data with a suitable end-marker (and/or start-marker).

...R

Robin2:
And my code will receive any form of serial data with a suitable end-marker (and/or start-marker).

No such luck.

I read this yesterday; perhaps I am over-simplifying the process. I built my own prox reader - so I know different card manufactures have different bit lengths for their facility code i.e., some use 8 bit and others use 10 bit. So as long as one is aware of the length, one can easily truncate the finished incoming data.

int SiteCodeLength = 4;
char INCOMING_DATA [21];
char CARDNUM[17];

void setup(){
  Serial.begin(115200);
  memcpy(INCOMING_DATA, "1C130327E9BAB5FF3FBF", sizeof(INCOMING_DATA)-1);
  memcpy(CARDNUM , String(INCOMING_DATA).substring(SiteCodeLength).c_str(), sizeof(CARDNUM)-1);

  delay(1000);
  Serial.print("INCOMING_DATA = ");
  Serial.println(String(INCOMING_DATA));

  Serial.print("CARDNUM = ");
  Serial.println(String(CARDNUM));
}

void loop(){}

The stuff in Reply #6 looks like text.

That is because the OP is using Serial.print(x,HEX).

Sterretje’s approach is the way to go, although I would use snprintf() to simplify the code dramatically.

From the link in reply #5:
frame.png

So, the first and last three bytes in each received frame could be simply ignored or removed.

sterretje:
No such luck.

So how is the start of a message identified?

...R

Robin2:
So how is the start of a message identified?

As this is a card reader, there is a dead period between the swiping of two cards; the first byte after that will be start of message.

sterretje:
As this is a card reader, there is a dead period between the swiping of two cards; the first byte after that will be start of message.

OK.

For that sort of system I have timed the interval between the arrival of bytes and when it is long enough it means the message has ended. However I don’t think I have a demo of that available.

…R

Tourneur:
In first Sirs ,

Many thanks for your help ,

In first sterretje, the data return converted in ASCII format concern uniquely the version of reader format ,the first fonction ,I was test.

After, all the data from the this reader, are in hex fomat.
Thats works ,but I’m trying to reduce the total data received from a Tag ID .

You have ,the mode ,the type of tag ,the CRC ,and the ID ,I would like to remove few of these frame and display them on the IDE monitor ,before display it on a little oled display.

The reader is Nano US, from Netronix ,it’s a multiprotocol reader .
I let here the sheets .

And my complete code.
Last version

/*

<> RFID Reading / Writting
    <> Nano-US v10 and Higher
    <> v 0.0.5
 
NEW > Software serial bus use for communication and harware for monitoring
    > L112 or L113 antenna
    > Firmware selecting mode
    > Reading hardware version
    > Custom shield used
 
  # Hardware Custom shield pins assignement :
 
    - Mode INTER1 > DO4
          INTER2 > DO5
          INTER3 > DO6
 
    - Uart Tx > D012
          Rx > DO11
*/

// ########### Library added ###########

#include <SoftwareSerial.h>

// ########### Variable ################

// Software serial used

SoftwareSerial ss(12, 11);

void monitoring_asc ()
{

ss.listen();                // Listen is frames presents
 
  delay(200);                // let a delay of 200 ms before reading
   
  while(ss.available() >0)  // 
  {
String inbyte = ss.readString(); // Use string function

inbyte.remove(2,1);              // Remove at position 2 of the frame one byte     
inbyte.remove(14,2);            // Remove at position 14 of the frame two bytes

Serial.print(inbyte); // Print the result on serial monitor 
delay(50);                  // Let a delay between frame
  }
}

void monitoring_hex ()
{

ss.listen();                // Listen is frames presents
 
  delay(200);                // let a delay of 200 ms before reading
   
  while(ss.available() >0)  // 
  {
  int inbyte = ss.read();
// String inbyte = ss.readString(); // Use string function

//inbyte.remove(2,1);              // Remove at position 2 of the frame one byte     
// inbyte.remove(14,2);            // Remove at position 14 of the frame two bytes

Serial.print(inbyte,HEX); // Print the result on serial monitor 
delay(50);                  // Let a delay between frame
  }
}

void setup()
{
// Serials (Hard and soft)

Serial.begin(19200);
  ss.begin(9600);

// Mode (UART mode used here, all Inter at high)
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
 
  digitalWrite (4, HIGH);
  digitalWrite (5, HIGH);
  digitalWrite (6, HIGH);

// ********* Command control *********

// ########### Show version of module #############

// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0xFE);            // Call version command

// CRC(xModem calculation)

ss.write(0xC6);            // CRCH 
  ss.write(0x14);            // CRCL
 
  monitoring_asc();
 
// ########### Select transponder type #############
 
  delay(500);                // Let a delay of 0,5 s before call a new command

// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0x02);            // Select transponder type changing
  ss.write(0x03);            // Type unique
  ss.write(0x01);            // With a gain of 0x1
 
// CRC(xModem calculation)

ss.write(0xE8);            // CRCH 
  ss.write(0x87);            // CRCL
 
  Serial.println();

monitoring_asc();
 
// ########### Turn on antenna #############
 
  delay(500);                // Let a delay of 0,5 s before call a new command

// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0x10);            // Select transponder type changing
  ss.write(0x01);            // Type unique
 
// CRC(xModem calculation)

ss.write(0xDA);            // CRCH 
  ss.write(0xF4);            // CRCL
 
  Serial.println();

monitoring_asc();
 
// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0x12);            // Select transponder type changing
 
// CRC(xModem calculation)

ss.write(0xFA);            // CRCH 
  ss.write(0xB6);            // CRCL

delay(1000);                // Let a delay of 0,5 s before call a new command 
  Serial.println();
 
}

void loop()
{
  // ########### Read transponder ID #############
 
  monitoring_hex();

delay(500);

}




jremington

"The easiest way to do that is to avoid use of unreliable Strings, and read all the bytes into a C-string, a zero terminated character array."

I 'm sure you have reason, but it's why I posted my question in this forum ...
Like I explained before ,I kept the little serial communication code from an web thread ,cause I was not arrive to realize a serial communication by myself ,even it's not my first program .

Possibilities ,thats I copied a bad and unadapted code are great possible .

I thinked this RFID system ,could not be very difficult ,and I realized my error ....

Tourneur:
In first Sirs ,

Many thanks for your help ,

In first sterretje, the data return converted in ASCII format concern uniquely the version of reader format ,the first fonction ,I was test.

After, all the data from the this reader, are in hex fomat.
Thats works ,but I’m trying to reduce the total data received from a Tag ID .

You have ,the mode ,the type of tag ,the CRC ,and the ID ,I would like to remove few of these frame and display them on the IDE monitor ,before display it on a little oled display.

The reader is Nano US, from Netronix ,it’s a multiprotocol reader .
I let here the sheets .

And my complete code.
Last version

/*

<> RFID Reading / Writting
    <> Nano-US v10 and Higher
    <> v 0.0.5
 
NEW > Software serial bus use for communication and harware for monitoring
    > L112 or L113 antenna
    > Firmware selecting mode
    > Reading hardware version
    > Custom shield used
 
  # Hardware Custom shield pins assignement :
 
    - Mode INTER1 > DO4
          INTER2 > DO5
          INTER3 > DO6
 
    - Uart Tx > D012
          Rx > DO11
*/

// ########### Library added ###########

#include <SoftwareSerial.h>

// ########### Variable ################

// Software serial used

SoftwareSerial ss(12, 11);

void monitoring_asc ()
{

ss.listen();                // Listen is frames presents
 
  delay(200);                // let a delay of 200 ms before reading
   
  while(ss.available() >0)  // 
  {
String inbyte = ss.readString(); // Use string function

inbyte.remove(2,1);              // Remove at position 2 of the frame one byte     
inbyte.remove(14,2);            // Remove at position 14 of the frame two bytes

Serial.print(inbyte); // Print the result on serial monitor 
delay(50);                  // Let a delay between frame
  }
}

void monitoring_hex ()
{

ss.listen();                // Listen is frames presents
 
  delay(200);                // let a delay of 200 ms before reading
   
  while(ss.available() >0)  // 
  {
  int inbyte = ss.read();
// String inbyte = ss.readString(); // Use string function

//inbyte.remove(2,1);              // Remove at position 2 of the frame one byte     
// inbyte.remove(14,2);            // Remove at position 14 of the frame two bytes

Serial.print(inbyte,HEX); // Print the result on serial monitor 
delay(50);                  // Let a delay between frame
  }
}

void setup()
{
// Serials (Hard and soft)

Serial.begin(19200);
  ss.begin(9600);

// Mode (UART mode used here, all Inter at high)
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
 
  digitalWrite (4, HIGH);
  digitalWrite (5, HIGH);
  digitalWrite (6, HIGH);

// ********* Command control *********

// ########### Show version of module #############

// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0xFE);            // Call version command

// CRC(xModem calculation)

ss.write(0xC6);            // CRCH 
  ss.write(0x14);            // CRCL
 
  monitoring_asc();
 
// ########### Select transponder type #############
 
  delay(500);                // Let a delay of 0,5 s before call a new command

// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0x02);            // Select transponder type changing
  ss.write(0x03);            // Type unique
  ss.write(0x01);            // With a gain of 0x1
 
// CRC(xModem calculation)

ss.write(0xE8);            // CRCH 
  ss.write(0x87);            // CRCL
 
  Serial.println();

monitoring_asc();
 
// ########### Turn on antenna #############
 
  delay(500);                // Let a delay of 0,5 s before call a new command

// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0x10);            // Select transponder type changing
  ss.write(0x01);            // Type unique
 
// CRC(xModem calculation)

ss.write(0xDA);            // CRCH 
  ss.write(0xF4);            // CRCL
 
  Serial.println();

monitoring_asc();
 
// Header 
  ss.write(0x01);            // Module adress ,default is 1
  ss.write(0x05);            // Frame length

// Command
  ss.write(0x12);            // Select transponder type changing
 
// CRC(xModem calculation)

ss.write(0xFA);            // CRCH 
  ss.write(0xB6);            // CRCL

delay(1000);                // Let a delay of 0,5 s before call a new command 
  Serial.println();
 
}

void loop()
{
  // ########### Read transponder ID #############
 
  monitoring_hex();

delay(500);

}




jremington

"The easiest way to do that is to avoid use of unreliable Strings, and read all the bytes into a C-string, a zero terminated character array."

I 'm sure you have reason, but it's why I posted my question in this forum ...
Like I explained before ,I kept the little serial communication code from an web thread ,cause I was not arrive to realize a serial communication by myself ,even it's not my first program .

Possibilities ,thats I copied a bad and unadapted code are great possible .

I thinked this RFID system ,could not be very difficult ,and I realized my error .... 
[
I am trying to do the same thing as above with a laser but I'm using a micro and the laser is on Serial1 how do I write that since listen wont work

@burtonrobotics

Please continue your questions here: https://forum.arduino.cc/index.php?topic=694171

Please do not put your questions/comments inside a quote. It’s difficult to find.