Arduino startup edit?

Hello is there a way to stop arduino from switching the outputs the first time you power the arduino? I have a relay shield connected and 4 motors connected on the relays but when i plug the arduino on the batteries it enables all the relays having problem with the motors. I have an arduino uno.

On start up all the arduino pins are defined as inputs, this is a processor thing. Sometimes this causes the them to float high, the normal correction is to have a pull down resistor on those outputs driving your relays.

However without knowing the circuit you have it is impossible to be definitive.

Sounds like you need pullups or pulldowns, whichever controls the relays to be in the off state while the Arduino pin outputs are undefined inputs during reset, testing for bootload activity, and then starting your sketch where they finally get set to outputs and a high/low level sent out.

You could also try using a programmer and Upload Using Programmer to skip the bootload test time and jump right to your sketch.

this is the scetch i am trying. can you point me to some more info of what you say because im a arduino noob. thank for your responce.

Got a link to the relay module you are using?

Did you see this note:
"The default state of the relay when the power is off for COMM (power) to be connected to NC (normally closed), this is the equivalent of setting the 4 Relay boards IN pin to HIGH (has +5v sent to it) It is a safety feature to not use the NC connector in-case you Arduino looses power it will automatically turns off all the devices connected to the relay. "

Are you using Common and NO as your connection points?

You may also want to disable the external power until some time after powering up.

Larry man...thought all the possible ways except the obvious one...you are right this is a more safe solution. I ll just plug the arduino and the after the initial start up i ll plug the power for the motors. Is there a way to remove from the bootloader the part of the code that runs through the inputs for the first time ?

Its actually 4 relays for 1 motor but every relay will have different voltage for spinning the motor on different speeds for a specific amount of time on each phase. Cycling from relay 1 to 4 one at a time

fuzzy_gr:
Is there a way to remove from the bootloader the part of the code that runs through the inputs for the first time ?

No, it's not a setting. It's how the chip is build to be.

Best way is to tie a resistor between the pin to drive a relay and to gnd (if LOW is the off state) or 5V (if HIGH is the off state).

But yeay, you don't like to answer questions. In fac't you don't answer questions at all.

Im on the phone. Didnt see moderators post. Here is the shield

http://www.ebay.com/itm/4-Channel-Relay-Module-DC-5V-Optocoupler-For-Arduino-PIC-ARM-AVR-DSP-HD23L-HP-/141510488546?pt=AU_B_I_Electrical_Test_Equipment&hash=item20f2aeb1e2

I used the common and NC. I ll check other ways

Try the Common and NO then.

Gotta love all the documentation that's made available. NOT!

Is there a way to remove from the bootloader the part of the code that runs through the inputs for the first time ?

Use a programmer and Upload Using Programmer to skip the bootload test time and jump right to your sketch.
The bootloader is not loaded at all then. Reset completes and your sketch starts.

Ok thank you for your time!