Help making LEDs blink like blinkers in a car I am trying to make blinkers and hazards lights for a car.  I can get
the left and right blinkers to work. I cannot figure out how to get
the lights to blink simultaneously like hazard lights would. 

What I think I want is that when both inputs are HIGH then Both LEDs will
blink together at the same time.

I left the garbage and comments in the code so you can see what I have
tried.

Thanks for your help.

/*
 Blinkers and Hazard Lights

 Simulates a vehicles blinkers and Hazard Lights
 left button connected to pin 2 using a pushdown resister
 right button connected to pin 3 using a pushdown resister
 left LED connected to pin 9
 right LED connected to pin 10
 Hazard LED is Pin 13 At one point I was trying to make pin 13 represent the hazard lights but that is not what I want to do.

 When left button is pushed Left LED will Blink
 When Right Button Is pushed Right LED will Blink

 If this worked the way I wanted it to. when both buttons where HIGH both LED 9 &amp; 10 would blink simultaneously.


 created 2015
 by thomsl41@gmail.com

*/

// constants won't change. They're used here to 
// set pin numbers:
const int buttonPinLeft = 2;     // the number of the pushbutton pin
const int buttonPinRight = 3;
const int buttonPinHazard = 2 &amp;&amp; 3;
const int ledPinLeft = 9;      // the number of the LED pin
const int ledPinRight = 10;
const int ledPinHazard = 13;

// variables will change:
int buttonStateLeft = 0;         // variable for reading the pushbutton status
int buttonStateRight = 0;
int buttonStateHazard = 0;

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPinLeft, OUTPUT);
   pinMode(ledPinRight, OUTPUT);
   pinMode(ledPinHazard, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPinLeft, INPUT);
  pinMode(buttonPinRight, INPUT);
  pinMode(buttonPinHazard, INPUT);  
}

void loop(){
  // read the state of the pushbutton value:
  buttonStateLeft = digitalRead(buttonPinLeft);
  buttonStateRight = digitalRead(buttonPinRight);
  buttonStateHazard = digitalRead(buttonPinHazard);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonStateLeft == HIGH) {     
    // turn LED on:    
  digitalWrite(ledPinLeft, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(500);              // wait for a second
  digitalWrite(ledPinLeft, LOW);    // turn the LED off by making the voltage LOW
  delay(500);              // wait for a second
  } 
 else {
    // turn LED off:
    digitalWrite(ledPinLeft, LOW); 
  }

if (buttonStateRight == HIGH) {     
    // turn LED on:    
  digitalWrite(ledPinRight, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(500);              // wait for a second
  digitalWrite(ledPinRight, LOW);    // turn the LED off by making the voltage LOW
  delay(500);              // wait for a second

} 
  else {
    // turn LED off:
    digitalWrite(ledPinRight, LOW); 
  }
}

/*if (buttonStateHazard == HIGH) {     
    // turn LED on:    
  digitalWrite(ledPinLeft, LOW);
  digitalWrite(ledPinRight, LOW);
  digitalWrite(ledPinHazard, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(2000);              // wait for a second
  digitalWrite(ledPinHazard, LOW);    // turn the LED off by making the voltage LOW
  delay(2000);              // wait for a second
  //} 
 //else {
    // turn LED off:
   // digitalWrite(ledPinHazard, LOW); 
 }

}
*/
It looks like you need to do something like:

if ((buttonStateRight == HIGH) &amp;&amp; (buttonStateLeft == HIGH)) {
    digitalWrite(ledPinRight, HIGH); 
    digitalWrite(ledPinLeft, HIGH); 
}
else if (buttonStateRight == HIGH) {
    digitalWrite(ledPinRight, HIGH); 
}
else if (buttonStateLeft == HIGH) {
    digitalWrite(ledPinleft, HIGH); 
}
//One delay for all
delay(500);
//Shut anything off that might be on after the delay
digitalWrite(ledPinRight, LOW); 
digitalWrite(ledPinLeft, LOW); 


Your code is really hard to read but it may mostly be because you need to insert four spaces at the beginning of each line of code to make it look right on this forum.