void setup() 
{
 pinMode(2,INPUT);
 pinMode(3,INPUT);
 pinMode(4,INPUT);
 pinMode(12,OUTPUT);

}

void loop() {

int flag = 0;

int startbutton = digitalRead(2);
if (startbutton == 1)
{
  flag = 1;
}

while(flag == 1)
{
  int onbutton = digitalRead(1);
  if(onbutton == 1)
{
  digitalWrite(12, HIGH);
}

if(onbutton == 0)

{
  digitalWrite(12, LOW);
}

int stopbutton = digitalRead(4);
if(stopbutton == 1)
{
  flag = 0;
}

if (stopbutton == 0)
{
  flag = 1;
}

}

}