Hello, I'm new to Arduino.
I wanted to make a push button that when I push, the motors work in order for 1 round until end without holding the button. And when I press the button again it starts the motor order process again. I only know basics about this because I just started. I also don't know how to connect push button with Arduino. My push button has 2 legs which seems to connect with wire, so do I need to use bread board and connect it to Arduino?
I've coded the way motor will work in order, I only need to connect the push button and make it run only 1 round when I push it. Please give me advices.
int In1 = 7;
int In2 = 8;
int ENA = 5;
int SPEED = 255;
int In3 = 4;
int In4 = 3;
int ENB = 2;
int In5 = 10;
int In6 = 9;
int ENA2 = 11;
void setup()
{
pinMode(In1,OUTPUT);
pinMode(In2,OUTPUT);
pinMode(ENA,OUTPUT);
pinMode(In3,OUTPUT);
pinMode(In4,OUTPUT);
pinMode(ENB,OUTPUT);
pinMode(In5,OUTPUT);
pinMode(In6,OUTPUT);
pinMode(ENA2,OUTPUT);
pinMode(stop, OUTPUT);
Serial.begin(9600);
lastB
void loop()
{
digitalWrite(In1,HIGH);
digitalWrite(In2,LOW);
Serial.println("Motor Right");
delay(1000);
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
Serial.println("Motor Stop");
delay(2000);
digitalWrite(In1,LOW);
digitalWrite(In2,HIGH);
Serial.println("Motor Left");
delay(1000);
digitalWrite(In1,LOW);
digitalWrite(In2,LOW);
Serial.println("Motor Stop");
delay(2000);
analogWrite(ENA,SPEED);
digitalWrite(In3,HIGH);
digitalWrite(In4,LOW);
Serial.println("Motor Right");
delay(1000);
digitalWrite(In3,LOW);
digitalWrite(In4,LOW);
Serial.println("Motor Stop");
delay(2000);
digitalWrite(In3,LOW);
digitalWrite(In4,HIGH);
Serial.println("Motor Left");
delay(1000);
digitalWrite(In3,LOW);
digitalWrite(In4,LOW);
Serial.println("Motor Stop");
delay(2000);
analogWrite(ENB,SPEED);
digitalWrite(In5,HIGH);
digitalWrite(In6,LOW);
Serial.println("Motor Right");
delay(1000);
digitalWrite(In5,LOW);
digitalWrite(In6,LOW);
Serial.println("Motor Stop");
delay(2000);
digitalWrite(In5,LOW);
digitalWrite(In6,HIGH);
Serial.println("Motor Left");
delay(1000);
digitalWrite(In5,LOW);
digitalWrite(In6,LOW);
Serial.println("Motor Stop");
delay(2000);
analogWrite(ENA2,SPEED)
}