int flag = 0;
void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
}
void loop() {
// read the sensor:
int start=digitalRead(2);
if(start==HIGH){flag=1;}
while(flag==1)
{
int button1=digitalRead(3);
int button2=digitalRead(4);
int stop=digitalRead(5);
if(button1==HIGH)
{
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
}
if(button2==HIGH)
{
digitalWrite(13, HIGH);
digitalWrite(12, HIGH);
}
if(stop==HIGH)
{
digitalWrite(13, LOW);
digitalWrite(12, LOW);
flag=0;
}
}
}