void setup() {
String hex_S = "6167653d41726b68616d";
const char *hex_str;
hex_str = &hex_S.c_str()[0];
char char_str[(strlen(hex_str)+2)/2]={0};
int i=0,j=0;
Serial.begin(115200);
for(i=0; i < strlen(hex_str); i+=2){
char temp[3] ={0};
memcpy(temp,&hex_str[i],2);
char_str[j++]=strtol(temp, NULL, 16);
}
Serial.print("Hex string: ");
Serial.println(hex_str);
Serial.print("\nCoverted Hex string: ");
Serial.println(char_str);
}
void loop() {
// put your main code here, to run repeatedly:
}
Loading
esp32-s2-devkitm-1
esp32-s2-devkitm-1