need help with turn signal jacket

I can’t get it to work and I can’t figure out why. I’ve redone a lot of the physical part and I know it’s not short circuiting. can anyone tell if there’s something wrong with my code or give suggestions?

int boardLED = 13;
int leftSignal = 8;
int rightSignal = 12;
int signalLow = 10;
int rightLow = 3;
int leftSwitch = 5;
int rightSwitch = 4;
int leftLED = 6;
int rightLED = 2;
int x, y;
int mode = 0;
int DAY = 0;
int NIGHT = 1;

void setup()
{
pinMode(boardLED, OUTPUT);

pinMode(leftSignal, OUTPUT);
pinMode(rightSignal, OUTPUT);

pinMode(signalLow, OUTPUT);
pinMode(rightLow, OUTPUT);

pinMode(leftSwitch, INPUT);
digitalWrite(leftSwitch, HIGH);
pinMode(rightSwitch, INPUT);
digitalWrite(rightSwitch, HIGH);

pinMode(leftLED, OUTPUT);
pinMode(rightLED, OUTPUT);

digitalWrite(boardLED, HIGH);
digitalWrite(signalLow, LOW);
digitalWrite(rightLow, LOW);
}

void loop()
{
checkLeft();
checkRight();
if (mode == NIGHT)
night();
else
day();
}

void checkLeft()
{
if (digitalRead(leftSwitch) == LOW)
{
digitalWrite(boardLED, LOW);
while (digitalRead(leftSwitch) == LOW)
{
if (digitalRead(rightSwitch) == LOW)
{
while (digitalRead(rightSwitch) == LOW | digitalRead(leftSwitch) == LOW);
mode = 1-mode;
digitalWrite(boardLED, HIGH);
return;
}
}
leftTurn();
}
}

void checkRight()
{
if (digitalRead(rightSwitch) == LOW)
{
digitalWrite(boardLED, LOW);
while (digitalRead(rightSwitch) == LOW)
{
if (digitalRead(leftSwitch) == LOW)
{
while (digitalRead(leftSwitch) == LOW | digitalRead(rightSwitch) == LOW);
mode = 1-mode;
digitalWrite(boardLED, HIGH);
return;
}
}
rightTurn();
}
}

void leftTurn()
{
for (x=0;x<10;x++)
{
digitalWrite(leftSignal, HIGH);
digitalWrite(leftLED, LOW);
for(y=0;y<10;y++)
{
delay(30);
if (digitalRead(leftSwitch) == LOW)
{
while (digitalRead(leftSwitch) == LOW);
digitalWrite(leftSignal, LOW);
digitalWrite(leftLED, LOW);
return;
}
}
digitalWrite(leftSignal, LOW);
digitalWrite(leftLED, HIGH);
for(y=0;y<10;y++)
{
delay(30);
if (digitalRead(leftSwitch) == LOW)
{
while (digitalRead(leftSwitch) == LOW);
digitalWrite(leftSignal, LOW);
digitalWrite(leftLED, LOW);
return;
}
}
digitalWrite(leftLED, LOW);
}
}

void rightTurn()
{
for (x=0;x<10;x++)
{
digitalWrite(rightSignal, HIGH);
digitalWrite(rightLED, LOW);
for(y=0;y<10;y++)
{
delay(30);
if (digitalRead(rightSwitch) == LOW)
{
while (digitalRead(rightSwitch) == LOW);
digitalWrite(rightSignal, LOW);
digitalWrite(rightLED, LOW);
return;
}
}
digitalWrite(rightSignal, LOW);
digitalWrite(rightLED, HIGH);
for(y=0;y<10;y++)
{
delay(30);
if (digitalRead(rightSwitch) == LOW)
{
while (digitalRead(rightSwitch) == LOW);
digitalWrite(rightSignal, LOW);
digitalWrite(rightLED, LOW);
return;
}
}
digitalWrite(rightLED, LOW);
}
}

void night()
{
digitalWrite(boardLED, LOW);

digitalWrite(rightSignal, HIGH);
digitalWrite(leftSignal, HIGH);
digitalWrite(leftLED, LOW);
digitalWrite(rightLED, LOW);
delay(100);
digitalWrite(rightSignal, LOW);
digitalWrite(leftSignal, LOW);
digitalWrite(leftLED, HIGH);
digitalWrite(rightLED, HIGH);
delay(100);
digitalWrite(leftLED, LOW);
digitalWrite(rightLED, LOW);
}

void day()
{

digitalWrite(boardLED, HIGH);
delay(1);
digitalWrite(boardLED, LOW);
digitalWrite(leftLED, HIGH);
delay (1);
digitalWrite(leftLED, LOW);
digitalWrite(rightLED, HIGH);
delay(1);
digitalWrite(rightLED, LOW);
delay (5);
}

While it was nice to use the hyper fast scroll wheel on my new Logitech mouse you need to modify your post so the code is in the right brackets. Highlight the code then click the # button in the message window.

You may be better off with doing a line that takes the digitalRead() and storing it to another variable. Then go threw and compare that variable as needed in you if() statements. You can declare the digitalRead(leftSwitch) and digitalRead(rightSwitch) in the loop.

while (digitalRead(rightSwitch) == LOW | digitalRead(leftSwitch) == LOW);

There are several lines like this in the code. The boolean or is ||. The logical or is |. I think that you want the boolean or here, not the logical one.

Even with the boolean or, the semicolon on the end means that this while loop is going to do nothing, if both switches are pressed, until one is released. I can't tell if that's intended, or not, for two reaons.

The first is this:

I can't get it to work and I can't figure out why.

We have no idea what works or what doesn't work. We have no idea what it is, what it is supposed to do, and what it is doing, or not doing.

The second is that there is not a single comment in the code to explain what is is supposed to be doing.

Go back and comment your code. Explain your problem, and post your code properly. Then, we can be more helpful.

One final thought:

void day()
{

 digitalWrite(boardLED, HIGH);
 delay(1);
 digitalWrite(boardLED, LOW);
 digitalWrite(leftLED, HIGH);
 delay (1);
 digitalWrite(leftLED, LOW);
 digitalWrite(rightLED, HIGH);
 delay(1);
 digitalWrite(rightLED, LOW);
 delay (5);
}

I'm not sure that you will even be able to see a 5 millisecond pause, let alone a 1 millisecond pause. Cycling LEDs that fast will make them appear dimmer, not to flash.

In programming '||' is more usually known as logical or (as is propositional logic), and '|' is known as bitwise or. Many languages use 'and' and 'or' rather than '&&' and '||' because its more, erm, logical!