I am having trouble with changing this small piece of code. Problem 67 years old


 i trying turn(convert) each of returned(found) unique serial numbers single  string variable. have been trying 4 days. :-(
 the serial numbers display in serial monitor have tried can think of concatenations, loading each hex part separate variables , concatenation them. can't figure out. it's driving me crazy. please help!
this taken 1 wire example scan connected probes serial numbers , works great. codes send unique serial numbers serial monitor. trying load variables can send thru http(wifi).

code: [select]

  void discoveronewiredevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
    serial.print("");
    while(ds.search(addr)) {
     serial.println("");
     serial.print("{");
     for( = 0; < 8; i++) {
     serial.print("0x");
     if (addr[i] < 16) {serial.print('0');}
     serial.print(addr[i], hex);
     if (i < 7) {serial.print(", ");}
    }
     serial.print("}");
       }
    ds.reset_search();
   serial.println("");
    return;
}


these returned serial numbers (serial monitor)

{0x28, 0x32, 0x03, 0xfe, 0x04, 0x00, 0x00, 0x29}
{0x28, 0x1e, 0xf6, 0xfd, 0x04, 0x00, 0x00, 0x1e}
{0x28, 0xfe, 0x0c, 0xfe, 0x04, 0x00, 0x00, 0xa4}

this trying accomplish.

probe1serialnumber = {0x28, 0x32, 0x03, 0xfe, 0x04, 0x00, 0x00, 0x29} //string variable
probe2serialnumber = {0x28, 0x1e, 0xf6, 0xfd, 0x04, 0x00, 0x00, 0x1e} //string variable
probe3serialnumber = {0x28, 0xfe, 0x0c, 0xfe, 0x04, 0x00, 0x00, 0xa4} //string variable



thank you!
ron derkis
rderkis@hotmail.com






if post entire sketch, i'm sure i'll able help.

btw when do, enclose between [code] , [/code] tags.


Arduino Forum > Using Arduino > Programming Questions > I am having trouble with changing this small piece of code. Problem 67 years old


arduino

Comments

Popular posts from this blog

arduino bug sur secteur, batterie, mais pas en usb?

Static ip - Raspberry Pi Forums

What voltage is sent to the arduino GND when a transistor is used