I think you need to lay out your algorithm, and then someone here could probably help you a bit more. Maybe something like this:
loop forever:
#If the machine is vending, don't start vending another fetus (gross)
if vending():
continue
button_pressed = get_depressed_button()
if button_pressed != NO_BUTTON_PRESSED:
# A button was pressed, dispense using the correct servo
vend_item(button_pressed)
# Helper functions
def get_depressed_button():
# Somehow reads sensor data and returns a constant that is associated with
# the button
return CORRECT_BUTTON
def vend_item(button):
turn appropriate servo based on button pressed
setup timer to turn off servo in XX seconds
I think this is a good start. Someone who actually understands robot programmign better than me can probably help you fill in the blanks!