Servo vert,hori; // create servo object to control a servo
int pos = 0; // variable to store the servo position
vert.attach(10); // attaches the servo on pin 9 to the servo object
int timeBetweenBursts = random(200,1000);
int timeBetweenShots = random(50,200);
int vertStart = random(1,180);
int vertEnd = random(1,180);
int horiStart = random(1,180);
int horiEnd = random(1,180);
int numShots = random(5,20);
int vertChange = (vertEnd - vertStart) / numShots; //how much to move vertical axis by each shot
int horiChange = (horiEnd - horiStart) / numShots;
vert.write(vertStart);//let it get to start position first, wait a little
for(int shot = 0; shot<numShots; shot++){
vertStart += vertChange;//increment the vert value for next time
delay(timeBetweenShots); //add a bit of variety to the speed of shots
delay(timeBetweenBursts);
digitalWrite(laser,HIGH);
delay(20);//adjust this to change length of turret shot