Prevent motor from spinning during boot up

Newbee here, playing around with the Arduino Uno starter kit.

I have connected 9V DC motor through the H-bridge.
In general the code/setup works as expected, I can start/stop the motor with a button etc.

My problem is that the motor spins a bit back and forth when Arduino boots.
Before it finally stops.

This is the case even with nothing at all in the setup/loop code blocks.
The only thing that seems to help is to uncomment the LCD initialization:
// LiquidCrystal lcd(8, 7, 5, 4, 3, 2);

I believe I have checked that the LCD pins and the H bridge pins are not mixed up.
Can I control the initialization sequence better?

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

We need to see your code and what hardware you are using, there are many different starter kits.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

An important fact to remember is that during start up:-

  1. The TX line is toggled to see if their is a device wanting to upload a new program.
  2. The bootloader toggles pin 13.
  3. All pins are set to input. - this means that things connected to the Arduino like a H-bridge will have floating inputs. The way round this is to utilise either pull up or pull down resistors on the outputs driving the bridge.

Thanks to your concise and precise boot up info, it works now.
I had one of the motor direction control pins connected to digital pin 13.
Moving this to pin 10 and it works :slight_smile:

I guess, in principle, I should tie the control pins to ground through a large resistor?

But thanks a lot.

Well not a large one, about 10K would be fine.