please help with driving two steppers and buttons

Hello!!
Im very new to arduino and trying to finish one project.Im not too good on programming so please help me a little to finish it.
My project is this.:UNO genuine board driving to nema17 steppers through two L298N boards.I need two buttons front-reverse in each motor individual at a constant speed.
I have tried to make something you can call a "program"but as you can see it is not working!!!!!i have figured how to drive one motor with buttons,how to drive two motors spinning in directions without buttons but CANNOT compile them!!!!following my program.Please tell me what to change

int clockwise= 2;
int anticlockwise= 3;
int clockwise= 12;
int anticlockwise= 13;
Stepper motor1(200, 4,5,6,7);
Stepper motor2(200, 8,9,10,11);

void setup() {
pinMode(clockwise,INPUT);
pinMode(anticlockwise,INPUT);
pinMode(clockwise,INPUT);
pinMode(anticlockwise,INPUT);
Serial.begin(9600);
}

void loop() {
int forward = digitalRead(clockwise);
int reverse = digitalRead(anticlockwise);
int forward = digitalRead(clockwise);
int reverse = digitalRead(anticlockwise);
digitalWrite(enable,LOW);
if(forward == 1 && reverse == 0 ){
digitalWrite(enable,HIGH);
motor1.step(1);
motor1.setSpeed(60);
digitalWrite(enable,LOW);
if(forward == 1 && reverse == 0 ){
digitalWrite(enable,HIGH);
motor2.step(1);
motor2.setSpeed(60);
delay(.01);
}
if(reverse == 1 && forward == 0 ){
digitalWrite(enable,HIGH);
motor1.step(-1);
motor1.setSpeed(60);
motor2.step(-1);
motor2.setSpeed(60);

delay(.01);
}
delay(5);
Serial.println(60);
}

any help please??????

You should post your code using the </> button.

You cannot redeclare variables like this;

int clockwise= 2;
int anticlockwise= 3;
int clockwise= 12;
int anticlockwise= 13;

Before using functions read the reference documentation and then use parameters of the correct type e.g. delay(ms) expects ms to be an unsigned long but you are making calls like this.

delay(.01);

It is a big mistake to write lots of code, without understanding what it is doing. In your case you have not even managed to get the code to compile.

I suggest you go back to square one. Write a very simple program that does nothing but loop round printing “Hello world”. At that point you have a program that compiles and executes. Now gradually build your program up a line at a time. Put plenty of print statements in the program. Because you are adding lines slowly if you start getting compile errors you will know exactly what line caused the problem and you just need to figure out what is wrong with what you wrote. Because you have lots of print statements in program if your program behaves unexpectedly you should be able to see where it went wrong.

Please don't Double Post. I already replied to your other Thread.

I am suggesting to the Moderator to merge the Threads.

...R

Robin2:
Please don't Double Post. I already replied to your other Thread.

I am suggesting to the Moderator to merge the Threads.

...R

Thats not a double post.
The other post is for a stepper only.you was answered to me about the delay.
now i tried to add two steppers with buttons for each stepper.

ardly:
You should post your code using the </> button.

You cannot redeclare variables like this;

int clockwise= 2;

int anticlockwise= 3;
int clockwise= 12;
int anticlockwise= 13;




Before using functions read the reference documentation and then use parameters of the correct type e.g. delay(ms) expects ms to be an unsigned long but you are making calls like this.



delay(.01);




It is a big mistake to write lots of code, without understanding what it is doing. In your case you have not even managed to get the code to compile. 

I suggest you go back to square one. Write a very simple program that does nothing but loop round printing "Hello world". At that point you have a program that compiles and executes. Now gradually build your program up a line at a time. Put plenty of print statements in the program. Because you are adding lines slowly if you start getting compile errors you will know exactly what line caused the problem and you just need to figure out what is wrong with what you wrote. Because you have lots of print statements in program if your program behaves unexpectedly you should be able to see where it went wrong.

I have made some very basic things with leds and lcd blinking and saying hello
My problem is to make the corrections on this program.
i was asked very politely for help.And all of you get angry with me and sayed to read and start from the beggining etc.
You can say that you dont want to help and thats all.
Thank you again for the precious help in this forum,
hopefully the net is very big and i will find help.The classic with all the forums,the unnamed user behind the screen saying what ever he wants
Have a nice day,and thank you again

george79:
I have made some very basic things with leds and lcd blinking and saying hello
My problem is to make the corrections on this program.
i was asked very politely for help.And all of you get angry with me and sayed to read and start from the beggining etc.
You can say that you dont want to help and thats all.
Thank you again for the precious help in this forum,
hopefully the net is very big and i will find help.The classic with all the forums,the unnamed user behind the screen saying what ever he wants
Have a nice day,and thank you again

Despite you not bothering to read and follow the rules on how to post, and not bothering to read the reference documentation you were given help politely. It would have been much simpler to say RTFMS.

Some of the issues giving you compilation errors were pointed out despite you not having the common sense to say what the error messages actually were. In addition you were given sound advice on how to build your program up so that it will not only compile but do what you actually want. Computer programming requires skill, patience and precision. You cannot type in garbage and then sit back lazily and expect others to sort it out for you.

Good luck in your quest to find better help than you would get here, I don’t fancy your chances.