Continuous servo, two pushbuttons, and LED's.

So, it sounds simple, right…? Yeah, that’s what I thought.
The first step I’m trying to figure out is how to get a continuous servo to run in one direction after a button press for 10 seconds.
Then next step is getting the servo to run in the opposite direction for 10 seconds with a different button press.
And then finally, have two sets of LED’s blink on/off alternating while the motor is running for the duration.
I’ve done a couple tutorials on turning the LED on the Arduino UNO on, blinking it, using a switch to turn it on, etc.
I’ve also done tutorials on getting the servo to run at a set speed for a duration as well.
The part I’m having trouble with is combining the tutorials to get what I need from the code and figuring out exactly how to wire it up.

My first focus is just getting a pushbutton to make the servo go for X seconds and stop.
And then I’ll move on to getting a pushbutton to make it go the opposite direction.
Then add in the LED’s after that. But, right now I hit send and it just runs without needing the button press to start.
So, at the moment my code looks like this and is giving an error.

#include <Servo.h>;
Servo servo; // create servo object to control a servo;
const int FWDbuttonPin = 3;
const int servoPin = 9;

int buttonState = 0;
int counter = 0;

void setup()
{
servo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode (FWDbuttonPin, INPUT);
}

void loop()
{
buttonState = digitalRead(FWDbuttonPin);
if (buttonState == HIGH)
{
counter++;
delay(200);
}
if(counter == 0)
servo.write (90); // zero degrees
else if(counter == 1)
servo.write(80);
delay(1000);
else
counter = 0;
}

I have the Arduino pins as follows.
Servo Power to 5V
Pushbutton Switch to 3.3V
Servo Ground to GND
Servo Signal to 9
Other side of switch to 3.

Any thoughts?

Thanks in advance. This is the first Arduino project I’m trying to do.

You need one more lesson to get there. Right now you are handling your timing by freezing everything with delay. But it won't work like that. While you are waiting on the led to blink you need to also be dealing with the servo. Your LED part "blocks" preventing anything else from happening.

Instead of freezing to wait on something to happen, take your step and move on. Every pass of loop see how long it has been since the last time you turned on the LED to see if it is time to turn it off again.

See the "Blink Without Delay" example and any of the hundreds of great tutorials on the topic. Google "Arduino Blink Without Delay" and there should be more than enough material to get you going on how to write non-blocking code.

The demo Several Things at a Time is an extended example of BWoD and illustrates the use of millis() to manage timing without blocking. It may help with understanding the technique.

Have a look at Using millis() for timing. A beginners guide if you need more explanation.

...R