One Wire HEX to Char String

I am having issues with my One Wire program. I am able to scan an iButton and read the correct S/N in serial.print. Well that does not help me if I want to look up that value against another string. How do I convert or change the code so i can save the value in a char string? I dont know if the answer is here because I dont understand it but here is a reference post that may help out in figuring this out.

Thanks again for the help. This is a really great community.

http://forum.arduino.cc/index.php?topic=43960.0
http://forum.arduino.cc/index.php?topic=205352.0

#include <OneWire.h>
#include "pitches.h"

OneWire reader(12);

void setup() {
  Serial.begin(9600);}
  
  
void checkStatus(){ byte addr[8]; reader.reset_search();
  if (!reader.search(addr)) {reader.reset_search(); return; } 
  else{iButton(); } }  
            
void  iButton(){
      int i;
      byte addr[8];
      byte addr2[8];
     
       
      reader.reset_search();
      
      while(reader.search(addr)) {
       for( i = 7; i > 0; i--) {
       if (addr[i] < 16) {
        Serial.print('0'); }
        
      if ( addr[2] + addr[6] + addr[5] + addr[4] + addr[3] == 00) {return;}   //Checks SN error 00000000
      
      Serial.print(addr[i], HEX); }      
               
     if (addr[0] < 2 ) { Serial.print("0"); Serial.print(addr[0], HEX); Serial.println(); } // checks last Hex. Adds 0 to 1 HEX
     else { Serial.print(addr[0], HEX); }
     tone(8, NOTE_DS8, 200);
     Serial.println(" "); delay(1000);
   } 
     reader.reset_search();
       }
       
       void loop()
    {
  checkStatus();
  Serial.println("Back to loop");
   delay(500);
     }

I am able to scan an iButton and read the correct S/N in serial.print.

Look at the code. Determine where you print each digit. Pay attention to what you are printing.

Note that there are NO strings involved. An array of bytes is not a string.

You can compare one array of bytes to another one, using memcmp().

The code is in Hex, and I need it to be a Char string. Reason being, the ibutton serial is going to be read and then stored briefly. Then that iButton S/N will compare to another string that has multiple S/N. Once it finds a match it will record that location then look for the next "," and print anything in between the SN and ","

I do not know how to take it from Serial.print to String

The code is in Hex

No, it was right there in your post.

and I need it to be a Char string.

C doesn't have a Char type. It has a char type.

Reason being, the ibutton serial is going to be read and then stored briefly.

That isn't a reason. That's an explanation.

Then that iButton S/N will compare to another string that has multiple S/N.

There is a function to compare strings. There is a function to compare arrays of bytes. Why does it matter to you which one you use?

I do not know how to take it from Serial.print to String

You StaRt by paYinG soMe attentioN to wHat you TyPe. Do not even think about wrapping your data in a String.

You helped me by saying I spelled things wrong. Not by actually explaining the process or anything I need to do.

PaulS told you that most of your assumptions are wrong, so you need to rethink your approach. In particular, there is no reason to convert any data received from the iButton. That should be a good start in a new direction.

When reading straight from the iButton, no conversion or anything, you have 3 issues, 1 Not in HEX, When in HEX does not add a 0 for "01" it will be "0" or "0E" would be "E", 3rd issue is, it prints it backwards.

Hex is just one way of representing a binary number.

SO I can print to a string then show that string as a hex?

Yes. Serial.print() - Arduino Reference
or use sprintf()