concatenate variables into integer

OK, this has got me pulling my hair out - if I had any

I’ve successfully gotten Arduino to talk to 2 x 1-wire temp sensors today. Hurrah. I used the excellent tutorial at playground/Learning/OneWire to achieve this and have hacked it a bit to my purposes. At the end of the code there are a series of Serial.print commands to send the info to the serial port. So far so good. The relevant section is below:

if (SignBit) // If its negative
  {
    Serial.print("-");
  }
  Serial.print(Whole);
  Serial.print(".");
  if (Fract < 10)
  {
    Serial.print("0");
  }
  Serial.print(Fract);
  Serial.print("\n");

Now to the bit I’m struggling with:

I want to use the value printed to serial as a float value to use in a relay control circuit operated by the Arduino. I did a bit of searching on the forum and can only find reference to strcpy() and strcat() which is apparently no good for signed integers. I want to end up with a “Temp” variable e.g.

int Temp;
Temp = 23.25; // or -23.25 although unlikely

As you may have guessed I’m quite new to this. Any suggestions gratefully received!

Thanks, Mark

int Temp;
Temp = 23.25;

An integer is, well, a whole number, it can’t have decimal fractions.

float Temp = Whole + (Fract / 100.0);

Works great for positive numbers. Unfortunately wire not long enough to get sensor in freezer to test negatives. Out with the laptop. Ice-cubes and salt a non-starter - no ice left!

I suspect that as whether the number is negative or not depends on a separate byte being sent it will return increasingly positive numbers as its temperature drops further.

Thanks for the prompt response AWOL - I'll report back.

Can you post your whole sketch? It's difficult to tell what you're trying to do. I don't quite see why you would want to re-input values you've printed.