arduino help

I know it’s build season, but I really need some help and I figured i’d give it a shot

i have an arduino uno board and have to run it on a 9 volt batteryand then run a 3v dc motor from the board starting with a 45 second delay then run the motor for a second then shut off
how would i do this i need help setting up the circut and programming it i would preferably like to use the blink code with and output on a digital pin but if you have any other ideas let me know
i should be able to run the motor with the power from the board and just have the battery supply power to the board itself

Thanks! btw this is my girlfriend’s account. the name i’ll be responding with is daignaultz

for the wiring, a darlington configuration H -Bridge is your best bet

to run the motor, you’ll do a pwm_allocate, then a pwm_write() (I think that those are correct). the delay is just a sleep function. If you have any trouble let us know.

As a second thought, depending on your electrical skill, you might consider investing in one of these: http://www.pololu.com/catalog/category/97

i do not have an h bridge but i only need it for one directionality shoulding i be able to power the board and then just power the motor from the board and control it with a delay

pardoning the broken speech, a relay will sufice if you just need the motor to spin one way.

You should NEVER source drive current from an arduino. Each pin is wired for only 20ma. You should source your motor current from the main bus rails of whatever you are building. If you are bent on only needing 3.3v, then you should use something like an LM317 to drop the voltage.

how would i set up a relay for the motor?

the relay uses a 12v coil, but the same steps apply to using a 9v one

Here the code you could use:

/***********
connect an NPN transistor driving a motor to pin 9 on arduino
***********/

int motorPin = 9;

void setup() {
pinMode(motorPin, OUTPUT);
delay(45000);
digitalWrite(9, HIGH);
delay(1000);
digtalWrite(9, LOW);
}

void loop() {
}