Transistor h-Bridge all NPN - Arduino code?

i constructed the circuit attached. Does anyone know how to replace the switches with the arduino; and what the code would look like?

If your motor runs on 5V then you can just replace the switches with Arduino pins (HIGH=switch pressed, LOW=switch not pressed).

If you motor needs more than 5V you will have to add some transistors because 5V on the Base will not be enough to turn off the high-side transistors.

With the all NPN H-bridge, if you send ones to both H-bridge inputs by mistake there will be smoke. Better to use a NPN-PNP bridge.

johnwasser:
If your motor runs on 5V then you can just replace the switches with Arduino pins (HIGH=switch pressed, LOW=switch not pressed).

If you motor needs more than 5V you will have to add some transistors because 5V on the Base will not be enough to turn off the high-side transistors.

Do i need pulldown resistors on the arduino pins? im using 4 and 6 where the jumpers intersect at the switch. I'm still a little confused on how to get this to work. can someone explain further?

No.

johnwasser:

[quote author=Keith Brown link=topic=172918.msg1284324#msg1284324 date=1371652011]
Do i need pulldown resistors on the arduino pins?

No.
[/quote]

So how do I get this to work?

replace all the 22K resistors with 1K resistors. connect Arduino pins to row 13 and 21 ( connected to resistors and side of switch NOT 5v). NEVER send a high on both Arduino outpus at he same time.

Depending on your transistors, since you say NPN, you are using BJTs. Assuming your transistors don't require more than 5mA of current each, you can just attach a properly sized resistor between an arduino pin and the base of the transistor. You can then control each transistor independently. However, you will just have to be very very careful that you never turn on the wrong transistors at once. You need to make sure you turn off any transistors before turning any other ones on.