3 servo motors controlled by push button

Hi all, I have a simple idea in my mind and i want to make it. The problem is that i do not know a lot about programming arduino so I hope any one help me. my project is to control 3 servo motors and control them using push button. each button control one motor, when one of them is clinked the motor will rotate 90o how I can do it ??

Start with this example code found in the IDE under examples and see what you can come up with to control the other servos

 Controlling a servo position using a potentiometer (variable resistor)
 by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

 modified on 8 Nov 2013
 by Scott Fitzgerald

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object

void loop() {
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there

You want code ?.

//Created msureshkumar2610@gmail.com

#include <Servo.h> // include servo lib

Servo myservo1;  // create servo objects to control a servos
Servo myservo2;
Servo myservo3;

const int button1 = 2;  // input pin used to connect the buttons
const int button2 = 3;
const int button3 = 4;

int buttonState1 = 0; //buttonstatus
int buttonState2 = 0;
int buttonState3 = 0;

//configuration inside setup function
void setup() {
  pinMode(button1,INPUT); //make this pins as input.
  myservo1.attach(9);  // attaches the servo on pin to the servo objects

  myservo1.write(0);//initial position or home position of servos

void loop() {
  buttonState1 = digitalRead(button1);
  buttonState2 = digitalRead(button2);
  buttonState3 = digitalRead(button3);

  if(buttonState1 == LOW){
  /*else if(buttonState1 == HIGH){
  if(buttonState2 == LOW){
  /*else if(buttonState2 == HIGH){
  if(buttonState3 == LOW){
  /*else if(buttonState3 == HIGH){

If you want servos automatically came back to position 0* when you release the button ?. then enable all else if statements in this code.

Make all the button pins tied with Vcc. (pull up)

Find the attachment the circuit I have attached.

For more subscribe my youtube channel
“Free Teaching Embedded Systems”