Skip to main content
More descriptive title
Link
Edgar Bonet
  • 45.2k
  • 4
  • 42
  • 81

Convert Char array How to Byte Array in Arduinoconvert an hex string to an array of bytes?

Bumped by Community user
Source Link
RS System
  • 61
  • 1
  • 1
  • 3

Convert Char array to Byte Array in Arduino

How to convert the char array to Byte array? I tried every method but it doesn't work.

char CardNumber[8] = "B763AB23"; // Length is 8, basically it's in Hex
                                 // B7 63 AB 23

I need to convert it into Byte array to byte CardNumberByte[4]; So basically, it should be like :

CardNumberByte[0] = B7;
CardNumberByte[1] = 63;
CardNumberByte[2] = AB;
CardNumberByte[3] = 23;

I am unable to find any solution for that.