Please help me!!!

Hello, sorry for any dumb questions but I am considered as a newbie. I need lots of help from the community on a project I am working on. This project is similar to the example blink program everyone knows but combines with if statements and more sequences. So my goal is this: Create a small scale turn signal working model that would be on the trailor for farm equipment. I need this model to help demonstate to a tech company what I would like them to do for the big project. So here is what I plan...

  • 3 switch inputs (flip switches)
  • left turn signal switch
  • right turn signal switch
  • brake switch
  • 6 led lights mounted on breadboard
  • 2 hazard lights
  • 2 brake lights
  • 1 right tailight (used for turning)
  • 1 left turn light (used for turning)

I want the arduino to stop what it is doing and do another sequence if I change the "mix" of switches on.
All the lights come on steady to start but the hazards are always blinking.

Sequence 1: Brake is applied ---> outcome: all lights are solid besides the hazards

Sequence 2: Brake is applied + right turn signal ---> outcome: Left turn light + Left brake light are solid. Right brake light and turn light are flashing.

Sequence 3: Brake is applied + Left turn signal --> outcome: Right turn light + right brake light are solid. Left brake light and turning light are flashing.

We'll start with that for now. If I need more help for more sequences, I will ask. Thanks and I want to make it clear that I want to work with you all, not make you all do it for me.

Good luck. Is there a question :wink:

Notes

Don’t use blink, use the blink without delay approach (based on millis()) so your code can immediately react when there is a change in the switches.

You can also read Using millis() for timing. A beginners guide to get an idea how to work with millis() based timings.

Since virtually everyone that starts a thread in the forum is looking for help - a better title than "Topic: Please help me!!!" might help people with limited time to decide if they might be able to help you

Good luck

welcome

please read HOW TO USE THIS FORUM
pay particular attention to #6

We'll start with that for now. If I need more help for more sequences, I will ask. Thanks and I want to make it clear that I want to work with you all, not make you all do it for me.

that is good, because we are great at helping your when you get stuck.
but do not do your work for you.

This compiled for a 2560. I didn't try to run it; don't expect it to work the first time. I'm not a programmer so it's probably kinda clunky but it should point you in an approximately-right direction.

You can add serial messages to check the state execution.

I would add switch debounce logic of some sort if the basics work for you.

// switch inputs
#define   SW_LEFT_TURN   2 //change these to whatever pin you're using
#define   SW_RIGHT_TURN  3
#define   SW_BRAKE       4

//lamp control outputs
#define   LAMP_LEFT_TURN  5
#define   LAMP_LBRAKE     6
#define   LAMP_RIGHT_TURN 7
#define   LAMP_RBRAKE     8
#define   LAMP_HAZARDS    9 //both controlled from one pin

#define   BLINK_FLAG      0x01
#define   CHK_SW_FLAG     0x02

#define   BLINKER_TIMER   500   //toggle turn sigs every 500mS
#define   SW_CHK_TIMER    50    //read switches every 50mS

//switch states
#define   ALL_OFF     0x00  //000 no switches       ALL_OFF
#define   BRAKE       0x01  //001 brake             BRAKE
#define   LEFT_TURN   0x02  //010 l-turn            LEFT_TURN
#define   BRAKE_LEFT  0x03  //011 l-turn + brake    BRAKE_LEFT
#define   RIGHT_TURN  0x04  //100 r-turn            RIGHT_TURN
#define   BRAKE_RIGHT 0x05  //101 r-turn + brake    BRAKE_RIGHT
//states 6 & 7 implausible; all on (exc. hazards)
#define   INVALID_STATE   0xF0

uint16_t
  blink_timer;  
uint8_t
  state,
  switch_state;
volatile uint8_t  
  switch_timer,
  timer_flags;

void setup() 
{
  //set up switch inputs
  pinMode( SW_LEFT_TURN, INPUT );
  pinMode( SW_RIGHT_TURN, INPUT );
  pinMode( SW_BRAKE, INPUT );

  //setup lamp control outputs
  //
  pinMode( LAMP_LEFT_TURN, OUTPUT );
  pinMode( LAMP_LBRAKE, OUTPUT );  
  pinMode( LAMP_RIGHT_TURN, OUTPUT );
  pinMode( LAMP_RBRAKE, OUTPUT );
  pinMode( LAMP_HAZARDS, OUTPUT );

  //all on to start
  digitalWrite( LAMP_LEFT_TURN, HIGH );
  digitalWrite( LAMP_LBRAKE, HIGH );
  digitalWrite( LAMP_RIGHT_TURN, HIGH );
  digitalWrite( LAMP_RBRAKE, HIGH );
  digitalWrite( LAMP_HAZARDS, HIGH );  

  blink_timer = BLINKER_TIMER;
  timer_flags = 0;
  switch_timer = 0;       //forces a read first pass
  state = INVALID_STATE;  //wait until we have a valid switch read
    
  //setup 1mS timer interrupt using compare
  OCR0A = 0x80;
  TIMSK0 |= _BV(OCIE0A);
    
}//setup

void loop() 
{
  //switches are read every SW_CHK_TIMER mS
  //might want to add some debouncing logic
  ReadSwitches();

  //hazards always flash
  //flash rate of hazards and turns is defined by BLINKER_TIMER
  digitalWrite( LAMP_HAZARDS, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
  
  switch( switch_state )
  {
    case  ALL_OFF:
      digitalWrite( LAMP_LEFT_TURN, LOW );
      digitalWrite( LAMP_LBRAKE, LOW );
      digitalWrite( LAMP_RIGHT_TURN, LOW );
      digitalWrite( LAMP_RBRAKE, LOW );      
    
      break;
      
    case  BRAKE:
      //Sequence 1:  Brake is applied    ---> outcome: 
      //all lights are solid besides the hazards
      digitalWrite( LAMP_LEFT_TURN, HIGH );
      digitalWrite( LAMP_LBRAKE, HIGH );
      digitalWrite( LAMP_RIGHT_TURN, HIGH );
      digitalWrite( LAMP_RBRAKE, HIGH );      
          
      break;
    case  LEFT_TURN:
      //
      digitalWrite( LAMP_LEFT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_LBRAKE, LOW );
      digitalWrite( LAMP_RIGHT_TURN, LOW );
      digitalWrite( LAMP_RBRAKE, LOW );      
    
      break;
    case  RIGHT_TURN:
      //
      digitalWrite( LAMP_LEFT_TURN, LOW );
      digitalWrite( LAMP_LBRAKE, LOW );
      digitalWrite( LAMP_RIGHT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_RBRAKE, LOW );      

      break;
    case  BRAKE_LEFT:
      //Sequence 3: Brake is applied + Left turn signal --> outcome:
      //Right turn light + right brake light are solid. 
      //Left brake light and turning light are flashing.
      digitalWrite( LAMP_LEFT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_LBRAKE, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_RIGHT_TURN, HIGH );
      digitalWrite( LAMP_RBRAKE, HIGH );      
    
      break;
    case  BRAKE_RIGHT:
      //Sequence 2:  Brake is applied + right turn signal ---> outcome:
      //Left turn light + Left brake light are solid. 
      //Right brake light and turn light are flashing.
      digitalWrite( LAMP_LEFT_TURN, HIGH );
      digitalWrite( LAMP_LBRAKE, HIGH );
      digitalWrite( LAMP_RIGHT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_RBRAKE, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      
      break;

    default:
      //implausible state; all lamps on for safety
      digitalWrite( LAMP_LEFT_TURN, HIGH );
      digitalWrite( LAMP_LBRAKE, HIGH );
      digitalWrite( LAMP_RIGHT_TURN, HIGH );
      digitalWrite( LAMP_RBRAKE, HIGH );      
      
      break;
      
  }//switch

}//loop

void ReadSwitches( void )
{
  //switch_state
  //0b76543210
  //  xxxxx||+----- brake
  //  xxxxx|+------ left-turn signal
  //  xxxxx+------- right turn signal
  //combinations
  //000 no switches       ALL_OFF
  //001 brake             BRAKE
  //010 l-turn            LEFT_TURN
  //011 l-turn + brake    BRAKE_LEFT
  //100 r-turn            RIGHT_TURN
  //101 r-turn + brake    BRAKE_RIGHT
  //110 r-turn + l-turn (not valid; lamps on exc. hazard)
  //111 r-turn + l-turn + brake (not valid; lamps on exc. hazard)

  if( switch_timer )
    return;
    
  switch_state = 0x00;
  switch_state |= (digitalRead( SW_BRAKE ) ? 0x01:0 );
  switch_state |= (digitalRead( SW_LEFT_TURN ) ? 0x02:0 );  
  switch_state |= (digitalRead( SW_RIGHT_TURN ) ? 0x04:0 );

  noInterrupts();
  switch_timer = SW_CHK_TIMER;
  interrupts();
  
}//ReadSwitches

//timer compare interrupt that gives us a 1mS interrupt
SIGNAL( TIMER0_COMPA_vect ) 
{
  //when blink timer expires, toggle flag bit and reset timer
  //blink bit always toggles
  blink_timer--;
  if( !blink_timer )
  {
    blink_timer = BLINKER_TIMER;
    timer_flags ^= BLINK_FLAG;
    
  }//if

  //decrement switch read timer to zero. mainline resets when switches are read
  if( switch_timer )
    switch_timer--;  
  
}//SIGNAL(TIMER0_COMPA_vect)

Just curious - why are the hazards lamps different to turn signal bulbs - usually they're repurposed

lastchancename:
Just curious - why are the hazards lamps different to turn signal bulbs - usually they're repurposed

[soapbox]
If the OP is in the US, Hazards are amber, turn lights are RED like brake lights.
Damn fool idea, in Australia, if a light is going to flash it HAS to be AMBER.

That way just seeing an AMBER light indicates it will flash.

With RED flash, you have to wait to see if it is going to flash or not the see if it is a brake or direction indicator.

https://www.youtube.com/watch?v=O1lZ9n2bxWA
[/soapbox]
Back to the OPs inquiry.

Can you tell us your electronics, programming, Arduino, hardware experience?

I think you want to make a portable, bolt on, bolt off set of taillights with a remote set of controls for equipment not fitted with tail lights.

I think you will find tow-truck owners, especially heavy equipment guys, already have such a system, in fact it is wireless.

Tom... :slight_smile:

With a proper subject line, people would be more likely to help

Hi Tom,

TomGeorge:
[soapbox]
If the OP is in the US, Hazards are amber, turn lights are RED like brake lights.
Damn fool idea, in Australia, if a light is going to flash it HAS to be AMBER.

That way just seeing an AMBER light indicates it will flash.

With RED flash, you have to wait to see if it is going to flash or not the see if it is a brake or direction indicator.

https://www.youtube.com/watch?v=O1lZ9n2bxWA
[/soapbox]
...

Tom... :slight_smile:

Four to five percent of people (nearly all of them are male) are deuteranopic - that is they are red/green colorblind. To a deuteranope amber lights are difficult to differentiate from red or green lights. Hopefully y'alls lights blink right away, and do not rely on color, in case the color seen wrong.

This subject is my soapbox issue. Many annunciators and controls use color in a way that makes it useless for me. Charge indicators are the worst.

I had an uncle that couldn't tell red from green. It used to get scary when they'd hang the stoplights sideways in some of these little towns to keep them from being hit by the log trucks. He knew red on top. But once it was sideways all bets were off.

I have a colleague who is red/green colourblind and for that reason hates bi-colour leds on equipment.

Delta_G:
I had an uncle that couldn't tell red from green. It used to get scary when they'd hang the stoplights sideways in some of these little towns to keep them from being hit by the log trucks. He knew red on top. But once it was sideways all bets were off.

Right! I used to work in New Mexico, and all th lights were sideways there. I'd just do what everybody else did, and if there was nobody else around, I'd assume the greenest of green. :wink:

Nowadays, they tinge green traffic signals with blue, making it more cyan, and thus completely different from red.

I have a colleague who is red/green colourblind and for that reason hates bi-colour leds on equipment.
[/quote]I don't mind them, but it all theoretical to me!

thanks for all the help. Here is what I have although I didnt use any of the suggestions, I would like some ideas to start from here.

// switch inputs
#define SW_LEFT_TURN 2 //change these to whatever pin you're using
#define SW_RIGHT_TURN 3
#define SW_BRAKE 4

//lamp control outputs
#define LAMP_LEFT_TURN 5
#define LAMP_LBRAKE 6
#define LAMP_RIGHT_TURN 7
#define LAMP_RBRAKE 8
#define LAMP_HAZARDS 9 //both controlled from one pin

#define BLINK_FLAG 0x01
#define CHK_SW_FLAG 0x02

#define BLINKER_TIMER 500 //toggle turn sigs every 500mS
#define SW_CHK_TIMER 50 //read switches every 50mS

//switch states
#define ALL_OFF 0x00 //000 no switches ALL_OFF
#define BRAKE 0x01 //001 brake BRAKE
#define LEFT_TURN 0x02 //010 l-turn LEFT_TURN
#define BRAKE_LEFT 0x03 //011 l-turn + brake BRAKE_LEFT
#define RIGHT_TURN 0x04 //100 r-turn RIGHT_TURN
#define BRAKE_RIGHT 0x05 //101 r-turn + brake BRAKE_RIGHT
//states 6 & 7 implausible; all on (exc. hazards)
#define INVALID_STATE 0xF0

uint16_t
blink_timer;
uint8_t
state,
switch_state;
volatile uint8_t
switch_timer,
timer_flags;

void setup()
{
//set up switch inputs
pinMode( SW_LEFT_TURN, INPUT );
pinMode( SW_RIGHT_TURN, INPUT );
pinMode( SW_BRAKE, INPUT );

//setup lamp control outputs
//
pinMode( LAMP_LEFT_TURN, OUTPUT );
pinMode( LAMP_LBRAKE, OUTPUT );
pinMode( LAMP_RIGHT_TURN, OUTPUT );
pinMode( LAMP_RBRAKE, OUTPUT );
pinMode( LAMP_HAZARDS, OUTPUT );

//all on to start
digitalWrite( LAMP_LEFT_TURN, HIGH );
digitalWrite( LAMP_LBRAKE, HIGH );
digitalWrite( LAMP_RIGHT_TURN, HIGH );
digitalWrite( LAMP_RBRAKE, HIGH );
digitalWrite( LAMP_HAZARDS, HIGH );

blink_timer = BLINKER_TIMER;
timer_flags = 0;
switch_timer = 0; //forces a read first pass
state = INVALID_STATE; //wait until we have a valid switch read

//setup 1mS timer interrupt using compare
OCR0A = 0x80;
TIMSK0 |= _BV(OCIE0A);

}//setup

void loop()
{
//switches are read every SW_CHK_TIMER mS
//might want to add some debouncing logic
ReadSwitches();

//hazards always flash
//flash rate of hazards and turns is defined by BLINKER_TIMER
digitalWrite( LAMP_HAZARDS, (timer_flags & BLINK_FLAG) ? HIGH:LOW );

switch( switch_state )
{
case ALL_OFF:
digitalWrite( LAMP_LEFT_TURN, LOW );
digitalWrite( LAMP_LBRAKE, LOW );
digitalWrite( LAMP_RIGHT_TURN, LOW );
digitalWrite( LAMP_RBRAKE, LOW );

break;

case BRAKE:
//Sequence 1: Brake is applied ---> outcome:
//all lights are solid besides the hazards
digitalWrite( LAMP_LEFT_TURN, HIGH );
digitalWrite( LAMP_LBRAKE, HIGH );
digitalWrite( LAMP_RIGHT_TURN, HIGH );
digitalWrite( LAMP_RBRAKE, HIGH );

break;
case LEFT_TURN:
//
digitalWrite( LAMP_LEFT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
digitalWrite( LAMP_LBRAKE, LOW );
digitalWrite( LAMP_RIGHT_TURN, LOW );
digitalWrite( LAMP_RBRAKE, LOW );

break;
case RIGHT_TURN:
//
digitalWrite( LAMP_LEFT_TURN, LOW );
digitalWrite( LAMP_LBRAKE, LOW );
digitalWrite( LAMP_RIGHT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
digitalWrite( LAMP_RBRAKE, LOW );

break;
case BRAKE_LEFT:
//Sequence 3: Brake is applied + Left turn signal --> outcome:
//Right turn light + right brake light are solid.
//Left brake light and turning light are flashing.
digitalWrite( LAMP_LEFT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
digitalWrite( LAMP_LBRAKE, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
digitalWrite( LAMP_RIGHT_TURN, HIGH );
digitalWrite( LAMP_RBRAKE, HIGH );

break;
case BRAKE_RIGHT:
//Sequence 2: Brake is applied + right turn signal ---> outcome:
//Left turn light + Left brake light are solid.
//Right brake light and turn light are flashing.
digitalWrite( LAMP_LEFT_TURN, HIGH );
digitalWrite( LAMP_LBRAKE, HIGH );
digitalWrite( LAMP_RIGHT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
digitalWrite( LAMP_RBRAKE, (timer_flags & BLINK_FLAG) ? HIGH:LOW );

break;

default:
//implausible state; all lamps on for safety
digitalWrite( LAMP_LEFT_TURN, HIGH );
digitalWrite( LAMP_LBRAKE, HIGH );
digitalWrite( LAMP_RIGHT_TURN, HIGH );
digitalWrite( LAMP_RBRAKE, HIGH );

break;

}//switch

}//loop

void ReadSwitches( void )
{
//switch_state
//0b76543210
// xxxxx||+----- brake
// xxxxx|+------ left-turn signal
// xxxxx+------- right turn signal
//combinations
//000 no switches ALL_OFF
//001 brake BRAKE
//010 l-turn LEFT_TURN
//011 l-turn + brake BRAKE_LEFT
//100 r-turn RIGHT_TURN
//101 r-turn + brake BRAKE_RIGHT
//110 r-turn + l-turn (not valid; lamps on exc. hazard)
//111 r-turn + l-turn + brake (not valid; lamps on exc. hazard)

if( switch_timer )
return;

switch_state = 0x00;
switch_state |= (digitalRead( SW_BRAKE ) ? 0x01:0 );
switch_state |= (digitalRead( SW_LEFT_TURN ) ? 0x02:0 );
switch_state |= (digitalRead( SW_RIGHT_TURN ) ? 0x04:0 );

noInterrupts();
switch_timer = SW_CHK_TIMER;
interrupts();

}//ReadSwitches

//timer compare interrupt that gives us a 1mS interrupt
SIGNAL( TIMER0_COMPA_vect )
{
//when blink timer expires, toggle flag bit and reset timer
//blink bit always toggles
blink_timer--;
if( !blink_timer )
{
blink_timer = BLINKER_TIMER;
timer_flags ^= BLINK_FLAG;

}//if

//decrement switch read timer to zero. mainline resets when switches are read
if( switch_timer )
switch_timer--;

}//SIGNAL(TIMER0_COMPA_vect)

Please start by reading the "How to use this forum" post and learn to post code correctly.

// switch inputs
#define   SW_LEFT_TURN   2 //change these to whatever pin you're using
#define   SW_RIGHT_TURN  3
#define   SW_BRAKE       4

//lamp control outputs
#define   LAMP_LEFT_TURN  5
#define   LAMP_LBRAKE     6
#define   LAMP_RIGHT_TURN 7
#define   LAMP_RBRAKE     8
#define   LAMP_HAZARDS    9 //both controlled from one pin

#define   BLINK_FLAG      0x01
#define   CHK_SW_FLAG     0x02

#define   BLINKER_TIMER   500   //toggle turn sigs every 500mS
#define   SW_CHK_TIMER    50    //read switches every 50mS

//switch states
#define   ALL_OFF     0x00  //000 no switches       ALL_OFF
#define   BRAKE       0x01  //001 brake             BRAKE
#define   LEFT_TURN   0x02  //010 l-turn            LEFT_TURN
#define   BRAKE_LEFT  0x03  //011 l-turn + brake    BRAKE_LEFT
#define   RIGHT_TURN  0x04  //100 r-turn            RIGHT_TURN
#define   BRAKE_RIGHT 0x05  //101 r-turn + brake    BRAKE_RIGHT
//states 6 & 7 implausible; all on (exc. hazards)
#define   INVALID_STATE   0xF0

uint16_t
  blink_timer;  
uint8_t
  state,
  switch_state;
volatile uint8_t  
  switch_timer,
  timer_flags;

void setup() 
{
  //set up switch inputs
  pinMode( SW_LEFT_TURN, INPUT );
  pinMode( SW_RIGHT_TURN, INPUT );
  pinMode( SW_BRAKE, INPUT );

  //setup lamp control outputs
  //
  pinMode( LAMP_LEFT_TURN, OUTPUT );
  pinMode( LAMP_LBRAKE, OUTPUT );  
  pinMode( LAMP_RIGHT_TURN, OUTPUT );
  pinMode( LAMP_RBRAKE, OUTPUT );
  pinMode( LAMP_HAZARDS, OUTPUT );

  //all on to start
  digitalWrite( LAMP_LEFT_TURN, HIGH );
  digitalWrite( LAMP_LBRAKE, HIGH );
  digitalWrite( LAMP_RIGHT_TURN, HIGH );
  digitalWrite( LAMP_RBRAKE, HIGH );
  digitalWrite( LAMP_HAZARDS, HIGH );  

  blink_timer = BLINKER_TIMER;
  timer_flags = 0;
  switch_timer = 0;       //forces a read first pass
  state = INVALID_STATE;  //wait until we have a valid switch read
    
  //setup 1mS timer interrupt using compare
  OCR0A = 0x80;
  TIMSK0 |= _BV(OCIE0A);
    
}//setup

void loop() 
{
  //switches are read every SW_CHK_TIMER mS
  //might want to add some debouncing logic
  ReadSwitches();

  //hazards always flash
  //flash rate of hazards and turns is defined by BLINKER_TIMER
  digitalWrite( LAMP_HAZARDS, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
  
  switch( switch_state )
  {
    case  ALL_OFF:
      digitalWrite( LAMP_LEFT_TURN, LOW );
      digitalWrite( LAMP_LBRAKE, LOW );
      digitalWrite( LAMP_RIGHT_TURN, LOW );
      digitalWrite( LAMP_RBRAKE, LOW );      
    
      break;
      
    case  BRAKE:
      //Sequence 1:  Brake is applied    ---> outcome: 
      //all lights are solid besides the hazards
      digitalWrite( LAMP_LEFT_TURN, HIGH );
      digitalWrite( LAMP_LBRAKE, HIGH );
      digitalWrite( LAMP_RIGHT_TURN, HIGH );
      digitalWrite( LAMP_RBRAKE, HIGH );      
          
      break;
    case  LEFT_TURN:
      //
      digitalWrite( LAMP_LEFT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_LBRAKE, LOW );
      digitalWrite( LAMP_RIGHT_TURN, LOW );
      digitalWrite( LAMP_RBRAKE, LOW );      
    
      break;
    case  RIGHT_TURN:
      //
      digitalWrite( LAMP_LEFT_TURN, LOW );
      digitalWrite( LAMP_LBRAKE, LOW );
      digitalWrite( LAMP_RIGHT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_RBRAKE, LOW );      

      break;
    case  BRAKE_LEFT:
      //Sequence 3: Brake is applied + Left turn signal --> outcome:
      //Right turn light + right brake light are solid. 
      //Left brake light and turning light are flashing.
      digitalWrite( LAMP_LEFT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_LBRAKE, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_RIGHT_TURN, HIGH );
      digitalWrite( LAMP_RBRAKE, HIGH );      
    
      break;
    case  BRAKE_RIGHT:
      //Sequence 2:  Brake is applied + right turn signal ---> outcome:
      //Left turn light + Left brake light are solid. 
      //Right brake light and turn light are flashing.
      digitalWrite( LAMP_LEFT_TURN, HIGH );
      digitalWrite( LAMP_LBRAKE, HIGH );
      digitalWrite( LAMP_RIGHT_TURN, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      digitalWrite( LAMP_RBRAKE, (timer_flags & BLINK_FLAG) ? HIGH:LOW );
      
      break;

    default:
      //implausible state; all lamps on for safety
      digitalWrite( LAMP_LEFT_TURN, HIGH );
      digitalWrite( LAMP_LBRAKE, HIGH );
      digitalWrite( LAMP_RIGHT_TURN, HIGH );
      digitalWrite( LAMP_RBRAKE, HIGH );      
      
      break;
      
  }//switch

}//loop

void ReadSwitches( void )
{
  //switch_state
  //0b76543210
  //  xxxxx||+----- brake
  //  xxxxx|+------ left-turn signal
  //  xxxxx+------- right turn signal
  //combinations
  //000 no switches       ALL_OFF
  //001 brake             BRAKE
  //010 l-turn            LEFT_TURN
  //011 l-turn + brake    BRAKE_LEFT
  //100 r-turn            RIGHT_TURN
  //101 r-turn + brake    BRAKE_RIGHT
  //110 r-turn + l-turn (not valid; lamps on exc. hazard)
  //111 r-turn + l-turn + brake (not valid; lamps on exc. hazard)

  if( switch_timer )
    return;
    
  switch_state = 0x00;
  switch_state |= (digitalRead( SW_BRAKE ) ? 0x01:0 );
  switch_state |= (digitalRead( SW_LEFT_TURN ) ? 0x02:0 );  
  switch_state |= (digitalRead( SW_RIGHT_TURN ) ? 0x04:0 );

  noInterrupts();
  switch_timer = SW_CHK_TIMER;
  interrupts();
  
}//ReadSwitches

//timer compare interrupt that gives us a 1mS interrupt
SIGNAL( TIMER0_COMPA_vect ) 
{
  //when blink timer expires, toggle flag bit and reset timer
  //blink bit always toggles
  blink_timer--;
  if( !blink_timer )
  {
    blink_timer = BLINKER_TIMER;
    timer_flags ^= BLINK_FLAG;
    
  }//if

  //decrement switch read timer to zero. mainline resets when switches are read
  if( switch_timer )
    switch_timer--;  
  
}//SIGNAL(TIMER0_COMPA_vect)

Ahhh…. Much better!

Please read post #3 and pay close attention to thee part about posting code - if you can't follow instructions to make life easier for those that you want to help you - you will have a tough time

And plus, have you tried running the code you posted in post 13 Forcepow?