Motors will not move in reverse

I’m quite new to Arduino, and I got a smart car project kit from an event near me. I ended up deleting the program on the Arduino Uno, and did something else. I came back to the car and I’ve tried to make my motors move (there are four) but I can only seem to get the motors to move in 1 direction, forward. No matter what I try I cannot get them to move backwards. They just move forward, wait 2 seconds, move forward, wait 2 seconds, loop. Can someone please help me, and inform me if I can use a better library?

Here is the current code I have:

#include <Stepper.h>

const int stepsPerRevolution = 200;
Stepper myStepper = Stepper(stepsPerRevolution, 0, 2, 3, 1);

void setup() {
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(A0, OUTPUT);
  myStepper.setSpeed(100);
}



void loop() {
  analogWrite(A0, 180);
  myStepper.step(200);
  delay(2000);
  analogWrite(A0, 0);
  myStepper.step(-200);
  delay(2000);
}

You need to provide a lot more information.

Start with a link to the datasheet or user-manual for your smart car project so we can understand exactly what hardware you have.

Can you re-install the original program onto the Arduino? Can you post a link to the code for that program?

...R

Why are you using pins 0 and 1 for the stepper? Those are the serial port.

analogWrite(A0, 180);

While (most) analog pins can be used as outputs, A0 is not usually a PWM pin so cannot be used for analogWrite().

If you have a Teensy 3.5, 3.6 or 4.0 then A0 is a PWM pin. I am not aware of any other variants which have this capability.

I am not using A0 currently, and I do not have any of the info for my smart car, none. I just wanted to know if there is a better way. I will use different pins than 0,1,2,3 and see if it works. Thanks for the help.

Does the car have a name? Search Google for the name.