help with project with two push buttons and one potentiometer and one motor

We were given this project in our class and I have been working for hours on this code and nothing seems to be clicking, I ensured all the wiring is set up and thats not the problem but Ill paste the question and Ill past my code. I get the motor to turn on for manual mode but I can’t get automatic mode to turn on.

Here is the assignment:

You are making a program to test a car engine. The system has two buttons and one potentiometer. To initially start the test, push button one. This will be the manual mode. The potentiometer controls the motor speed. Push button one again to enter the automatic test mode. This should be a function call that will run at 25% for 2 seconds, 50% for 2 seconds, 75% for 2 seconds, then 100% for 5 seconds. After that it will slow down to 15% for 5 seconds. The deceleration should take about 3-5 seconds. (Your motor may not run at 15%, if not, use the slowest speed below 25% that it will run). Repeat this automatic speed change cycle until the second push button is pushed to exit the function and stop everything. The second push button should also stop the manual cycle. Print the motor speed data in the serial plotter 4 times per second for at least three minutes total for both the manual and automatic modes.

I attached my code:

week9day2check3.ino (1.87 KB)

I attached my code:

Posting it would've been better, IMO

void manualMode(){
  while(manual == true) {
    int motorSpeed= map(analogRead(A0), 0 , 1023, 0, 255);
    analogWrite(motor, motorSpeed);
    flipflop();
    emergencystop();
  }
}

Why are you calling flipflop() here?

What does an emergency stop have to do with reading switch states and setting manual/automatic mode?

You are way too fascinated with reading the switch state(s).