Help with random servo moveemnts

I am trying to make a fish feeder that goes off every 24 hours and with a press of a button, but throughout the day it randomly feeds instead of every 24 hours or when i press a button. If you need any other information provided just ask.

Thank You!

"#include <Servo.h>

const int buttonPin = 2;
int buttonState = 0;
Servo servoA;
int position = 0;

void setup() {

// put your setup code here, to run once:
servoA.attach(9);
servoA.write(45);
pinMode(buttonPin,INPUT);
}

void loop() {
static unsigned long lastTime;
if(millis() - lastTime > 86400000) {
lastTime = millis();
loopA();

}
buttonState = digitalRead(buttonPin);
if(buttonState == HIGH)
{
loopA();
}

}
void loopA(){

for(position = 45; position < 80; position++){

servoA.write(position);

delay(5);

}
for(position = 80;position >45; position–){
servoA.write(position);
delay(5);

}

}

"

AutoFish.ino (686 Bytes)

Post the code inline with code tags. Take a look at the stickies at the top of this forum.