Reverse

I am extremely new to arduino and coding. Are you guys able to give me a code that reverses everything in sequence after pushing a single button. 2 motors are activated and then after then it waits for 5 seconds until activating the other motor I want to reverse every thing including the rotation of the motors by pushing a single button.

I am using tinkercad and since do not know how to write codes, use blocks instead. Please help.

There is a code below you guys can refer to. The code gets automatically written when placing blocks.

Thanks.

CODE:
int i = 0;

int j = 0;

void setup()
{
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(9, OUTPUT);
}

void loop()
{
analogWrite(6, 200);
analogWrite(5, 200);
delay(5000); // Wait for 5000 millisecond(s)
analogWrite(9, 200);
}

Matt_code123:
Are you guys able to give me a code

Most of the regulars here don't see themselves as being here to "give" code. However we are here to help you if you run into a problem with your own code.

Based on what you have posted I suspect you would make progress much more quickly if you focus only on the Arduino code and forget about the blocks. Study the piece of code you have posted. Do you understand what each line of code does? If not, tell any line you have a problem with and we will try to explain.

When you understand what each line does I suspect a solution to your problem about reversing the direction of the motors will occur to you without really needing out help.

You should also tell us what motor drivers you are using and make a simple pencil drawing showing how you have connected things, then post a photo of the drawing.

For the future, to make it easier for people to help you, when posting code please use the code button </>
codeButton.png
so your code looks like this

int i = 0;

int j = 0;

void setup()
{
 pinMode(6, OUTPUT);
 pinMode(5, OUTPUT);
 pinMode(9, OUTPUT);
}

void loop()
{
 analogWrite(6, 200);
 analogWrite(5, 200);
 delay(5000); // Wait for 5000 millisecond(s)
 analogWrite(9, 200);
}

...R

If you want to reverse a motor direction, you must use an H-bridge module to drive the motor and toggle its DIR (direction) pin.