headlight control

gpop1:
I think this is what you want

const int lowBeamInput = 2;

const int highBeamInput = 3;
const int leftLowBeamRelay = 4;
const int rightLowBeamRelay = 5;
const int leftHighBeamRelay = 6;
const int rightHighBeamRelay = 7;

unsigned long previousMillis = 0;
byte LowBeamHold = 0;

void setup() {
  // put your setup code here, to run once:
  digitalWrite (leftHighBeamRelay, HIGH); //high is off
  digitalWrite (rightHighBeamRelay, HIGH);
  digitalWrite (leftLowBeamRelay, HIGH); //low is on
  digitalWrite (rightLowBeamRelay, HIGH);

pinMode ( lowBeamInput, INPUT);
  pinMode ( highBeamInput, INPUT);
  pinMode ( leftLowBeamRelay, OUTPUT);
  pinMode ( rightLowBeamRelay, OUTPUT);
  pinMode ( leftHighBeamRelay, OUTPUT);
  pinMode ( rightHighBeamRelay, OUTPUT);

//Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  unsigned long currentMillis = millis();
  byte lowBeam = digitalRead(lowBeamInput);
  byte highBeam = digitalRead(highBeamInput);

//presuming the car will not allow me to choose high beams or low
  //beams unless the lights are turned on

if (highBeam == 1) {//lights on
    digitalWrite (leftHighBeamRelay, LOW); //low is on
    digitalWrite (rightHighBeamRelay, LOW);
    // Serial.println ("high beams are on");
  } else {//lights off
    digitalWrite (leftHighBeamRelay, HIGH); //high is off
    digitalWrite (rightHighBeamRelay, HIGH);
    // Serial.println ("high beams are off");
  }

if ((highBeam == 1) || (lowBeam == 1)) {
    digitalWrite (leftLowBeamRelay, LOW); //low is on
    digitalWrite (rightLowBeamRelay, LOW);
    // Serial.println ("low beams are on");
    previousMillis = currentMillis;
    LowBeamHold = 1;
  } else {
    LowBeamHold = 0;
  }
 
 
  // 1/2 second delay between when lights are turned off until low beams turn off
  // this is in case both relays are open at the same time for thousands of a second
  //switching between high and low beam
  if ((currentMillis - previousMillis > 500) && (LowBeamHold == 0)) {
    digitalWrite (leftLowBeamRelay, HIGH); //low is on
    digitalWrite (rightLowBeamRelay, HIGH);
    // Serial.println ("low beams are off");
  }

}

well the code works... i think the lights on my relay board change intensity like its working but the relay doesnt actualy change state, i dont know if its a hardware side issue or what, but something isnt working right.

Ogmudbones:
well the code works... i think the lights on my relay board change intensity like its working but the relay doesnt actualy change state, i dont know if its a hardware side issue or what, but something isnt working right.

if you are testing on a bread board make sure the buttons have a 10k resistor pull down on them.

that means a resistor from the arduino input pin to ground rail of the bread board.

If the pins are floating (not true 0v) then it make be telling the relays to turn on and off hundreds of times a second.

Post a pic of your wiring or scribble it on paper and post that if you need assistance.

gpop1:
if you are testing on a bread board make sure the buttons have a 10k resistor pull down on them.

that means a resistor from the arduino input pin to ground rail of the bread board.

If the pins are floating (not true 0v) then it make be telling the relays to turn on and off hundreds of times a second.

Post a pic of your wiring or scribble it on paper and post that if you need assistance.

I got lm7805's pulling the voltage down on the inputs with 1k pulldown resistors, the relay input pins are floating, there arent any buttons or a breadboard, its just kinda all soildered together just touch 12 volts to the input side of things to see what happens