First arduino project-need help

I am working on a simple servo timer for a school project. The thing is, I don't know pretty much anything about programming arduino. So could someone give me some pointers on how to program the board?

I am using an arduino pro mini.

I'm thinking i want the program to start as soon as I power on the board with a switch. then the program will wait 3 seconds before the servo turns 90 degrees. After that, the servo will turn back to the "home" position 1 second after the initial 90 degree turn.

I've looked online for example code and things but I really don't know what the right code looks like, or how to change the variables. Thanks!

Did you look at the examples in the servo library that ships with the IDE?

And don't use the Arduino's 5V supply to power any servo except the smallest micro-servo. They need their own power supply.

first, if it is a school 'assignment', you should have been given some class instruction on the related hardware/software. if it is part of a assigned project where you decided that the arduino was a good solution, then YOU, not US, have some reading to do.

in either case, nobody here is going to be inclined to provide any assistance until some evidence of work you have done is presented. we don't do your homework for you. although you might be able to hire someone in the gigs forum.

to start learning, try out the examples in the ide and figure out what they are doing and how. then look in the playground for similar projects and try to pick up some hints from them.

then start building your project. when you hit a stumbling block, come back here and present your work and ask questions. somebody will be glad o coach you along.

Welcome to Arduino World

Start by looking at the examples in the IDE. After looking at and trying the basics try the Servo Sweep example. It does most of what you describe and can be modified.

Do not be tempted to power the servo from the Arduino GND and 5V pins as they cannot safely supply enough current and may damage the Arduino. Where did you get the servo ? Is it a normal servo or a "continuous rotation servo" ? What you want is the former.

Will the Arduino be doing anything else apart from what you describe either now or in an expanded version of the project ? Does the servo need to move more than once or is what you describe all that is required ?

Who has provided the specification for your project ?

Now the code.


Doing the homework for a student is robbing them of the opportunity to learn. Do not rob the students.
Coach them? Absolutely. As was being done by the previous posts.

I highly recommend that you edit your post to remove the solution that you created, and allow the student the opportunity to learn.

Edit: Thank you khatwani2

The solution is even wrong. It does not follow the requirements of waiting 3 seconds at the start, and there's no requirement of repeating the movement as that solution will do. OP mentions a single movement.