Digital output goes high on power up

Hello,
I have a fairly simple sketch that sets a digital out to high when temperature input goes high.
If I power the Arduino from USB, everything works fine, but with the Arduino disconnected from the USB and running from a 5V power supply, the digital output goes high for the first 5-10 seconds, then works normally. As the output will eventually be controlling external equipment such as ventilation fans, I don't want this initial turn on. Is there any way to keep this output low during the first power up?
Thanks
Arduino fan, but complete novice.

Is there any way to keep this output low during the first power up?

Probably. I'd want to see your code, first though.

When powered up, the Arduino goes through exactly the same steps when powered by USB or battery/wall-wart.

If you are seeing some differences, I'd question how you are powering it.

Sorry,
Dumb question from first timer.
How do I copy sketch into a reply?
Thanks

Depending on the length, copy / paste. Wrap it with "code" tags (press the # button in the post editor).

Thanks James - a complete novice here

Here is the sketch, lifted from Sheepdog. I tried to get the OneWire example to work , but it didn't - this one does.
The only bit of code the I have added to try and stop the initial digital high is at the start commented //PGS added this.
The USB and PSU thing was a red herring and you get this initial high on both power sources.

/*ReadDS18B20
ver: 6 Jly 2010
THIS IS A FIRST DRAFT.... WORKS, but scheduled for overhaul.


Simple, simple test of reading DS18B20
connected to nuelectronics.com datalogging shield.

See...

http://sheepdogguides.com/arduino/ar3ne1tt.htm

... for explanation of this code.

Code lightly adapted from code from nuelectronics.com*/

#define TEMP_PIN  14 //See Note 1, sheepdogguides..ar3ne1tt.htm
#define LED 12//PGS added this line

void OneWireReset(int Pin);//See Note 2
void OneWireOutByte(int Pin, byte d);
byte OneWireInByte(int Pin);

void setup() {
    digitalWrite(TEMP_PIN, LOW);
    pinMode(TEMP_PIN, INPUT);      // sets the digital pin as input (logic 1)
Serial.begin(9600);
//9600 to match the data rate being used by the
//serial monitor on my system, which is set to
//the Arduino default. (Sample code published
//by nuelectronics used a faster baud rate.)
    delay(100);
    Serial.print("temperature measurement:\n");
    
    digitalWrite (LED,LOW);//PGS added this line - this was my attempt to keep it low
}



void loop(){
  pinMode(LED,OUTPUT);//added this line
  
  int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;

  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0x44); // perform temperature conversion, strong pullup for one sec

  OneWireReset(TEMP_PIN);
  OneWireOutByte(TEMP_PIN, 0xcc);
  OneWireOutByte(TEMP_PIN, 0xbe);

  LowByte = OneWireInByte(TEMP_PIN);
  HighByte = OneWireInByte(TEMP_PIN);
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25

  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;
  //removed led flash from this point

//do {
 // digitalWrite(LED,HIGH);//added this line
//}
//while(Tc_100>2700); //added this line
//Serial.print("high");//added this line





//digitalWrite(LED,LOW);//ADDED THIS LINE
//delay(100);
//digitalWrite(LED,HIGH);
//delay(100);


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

  Serial.print(Fract);
  Serial.print("   ");//added this line
  Serial.print(Tc_100);//added this line
  
  if(Tc_100>2500){
    Serial.print("   Over temperature");
    digitalWrite(LED,HIGH);
  }
  else {
    Serial.print("   Normal temperature");
    digitalWrite(LED,LOW);
  }

      Serial.print("\n");
  delay(5000);      // 5 second delay.  Adjust as necessary
}

void OneWireReset(int Pin) // reset.  Should improve to act as a presence pulse
{
     digitalWrite(Pin, LOW);
     pinMode(Pin, OUTPUT); // bring low for 500 us
     delayMicroseconds(500);
     pinMode(Pin, INPUT);
     delayMicroseconds(500);
}

void OneWireOutByte(int Pin, byte d) // output byte d (least sig bit first).
{
   byte n;

   for(n=8; n!=0; n--)
   {
      if ((d & 0x01) == 1)  // test least sig bit
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(5);
         pinMode(Pin, INPUT);
         delayMicroseconds(60);
      }
      else
      {
         digitalWrite(Pin, LOW);
         pinMode(Pin, OUTPUT);
         delayMicroseconds(60);
         pinMode(Pin, INPUT);
      }

      d=d>>1; // now the next bit is in the least sig bit position.
   }

}

byte OneWireInByte(int Pin) // read byte, least sig byte first
{
    byte d, n, b;

    for (n=0; n<8; n++)
    {
        digitalWrite(Pin, LOW);
        pinMode(Pin, OUTPUT);
        delayMicroseconds(5);
        pinMode(Pin, INPUT);
        delayMicroseconds(5);
        b = digitalRead(Pin);
        delayMicroseconds(50);
        d = (d >> 1) | (b<<7); // shift d to right and insert b in most sig bit position
    }
    return(d);
}

I am a very late entrant to Arduino, but can see huge potential for domestic energy control and monitoring. I would like to get a number of sensors around the house, mainly temperature, but some humidity. I used to do a lot of work with PLC's,but most of the hard work has been done with them ref code writing, so just getting an LED on is quite an achievement.
the outputs will be used to control extract fans etc.

On the PLC's I worked with, there used to be a facility to "force" an output on to test it - is there anything like that on the Arduino?

digitalWrite (LED,LOW);//

You need to set the pinMode for this pin

    digitalWrite(TEMP_PIN, LOW);
    pinMode(TEMP_PIN, INPUT);      // sets the digital pin as input (logic 1)

You've turned off the pullup on this pin; is that what you intended?
(you're supposed to do it after you set the pinMode)

Thanks AWOL,
I didn't write the second quoted bit of code - that was copied from Sheepdogguides who seem to have copied it from Nuelectronics.
I tried swapping the two lines to no effect. This initial digital high is annoying rather than anything else. Should this bit of code be located somewhere else?

void loop(){
  pinMode(LED,OUTPUT);//added this line  <--- that should be in setup() 
  
  int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;

Thanks all so far.
I think I have clue what the problem might be.
The Dallas datasheet gives 85 degrees C as a special number which is the device reset output on initial power up.
I caught this number in the serial monitor, and as I have set the digital output to go high on temperatures above 25 degrees, this why it goes high initially.
Tested this by setting my digital output to go high only on temperatures above 85 degrees, and problem solved, no digital output on power up.
Just need to find a way to keep this number out for about 5 seconds.