Hey guys, im new to this whole arduino thing

, i was just wondering if theres a way where an analog input button can
run a servo for just one loop, for example i want to run this just once when button 1 is pressed:
#include <Servo.h>
Servo myServo;
void setup() {
myServo.write(180); // Start at 180 degrees instead of 90
myServo.attach(9); // Attaches servo for turning
myServo.attach(10); // Attaches servo for grabbing
myServo.attach(11); // Attaches servo to raise arm
}
void loop() {
myServo.attach(9); // Attaches and apply power
myServo.write(90); // Position servo
delay(300); // Allow transit time
myServo.detach(); // Detach and remove power
delay(300);
}
.....................
and this when button two is pressed:
myServo.attach(11); // Attaches and apply power
myServo.write(90); // Position servo
delay(300); // Allow transit time
myServo.detach(); // Detach and remove power
delay(300);
}
is this even possible? any helpful thoughts would be much appreciated! Thanks!!