Blinker/brake light motorcycle

I'm getting an arduino Dumelopotive soon and I am going to make a night rider style break light on my brothers motor cycle.

I want there to be 8 leds in a strip from left to right on the tail (that will probably be encased)


On the right is how his cycle will look finished ,but he's still modding it.

What I want to happen is the LEDs would make a scrolling pattern left to right when there is no break or turn signal active.
(like the old night rider car)

But when the breaks are hit the LEDs would all glow and be brightener than while scrolling. (easy to do with the coding)

for turn signals I need to know how to connect a momentary button to the arduino so that I can use an if statement if the button is pressed it will activate the last 2 leds on the right to blink on and off.

however another if statement would see if the button was pressed 2 times in 1 second (or whatever is a convenient time) or it could be held down for 1 /2 a second to get the left blinker to activate

And if the button was pressed again it would stop the turn signals from going.

I have some ideas of how to do most of this but i need input on the buttons.

thanks,
TBM

Just a bit of an update , sorry about the double post, I think I've got my circuit laid out, but I'm not 100% sure it'll work.

Bigger version.

The key in the circuit is those buttons and transistors. that's mostly what I'm unsure about I just need a way to activate the left most or right most LEDs and make them blink.

I may eventually figure out how to code this if it even will work :stuck_out_tongue:

hmm, cool I might try that, the only part I don't entirely understand is how to connect 3 buttons, one for the left blinker ,one for the right, and one for the brake to make that happen.

the coding would take over after one of the 3 buttons is pressed.
I think for that I can do the coding on my own. ;D

Thanks for the reply.

Yes! thank you so much, I completed my hardware and my coding, this is the first time Ive ever coded anything other than [img*][/img*] so I'm pretty excited.

int timer = 150
int ledPins[] = { 5,6,7,8,9,10,11,12 };
int pincount = 8;
int inputPin1 = 2;
int inputPin2 = 3;
int inputPin3 = 4;

void setup () {
  
  int thisPin
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < pincount; thisPin++)   {
    pinMode(ledPins[thisPins], OUTPUT) ;
  }


void loop () (
// loop from the lowest pin to the highest: 5-12 IE the 8 leds
  for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(timer);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);    

  }

  // loop from the highest pin to the lowest:
  for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);
  }
  // if right button is puhed leds blink for 10 seonds every second
if (digitalRead(inputPin1)==low {
for (int i; i < 6;0++) {
  // make sure leds connected to pins 5 and 6 are on hte right
  digitalWrite(ledPin 5,6,high);
  delay(1000) 
  digitalWrite(ledpin 5,6,low);
  delay(1000)
  }
}

  // if left button is puhed leds blink for 10 seonds every second
if (digitalRead(inputPin2)==low) {
for (int i; i < 6;0++) {
  // make sure leds connected to pins 5 and 6 are on hte right
  digitalWrite(ledPin 11,12,high);
  delay(1000) 
  digitalWrite(ledpin 11,12,low);
  delay(1000)
  }
}

//Brake sequence
if (digitalread(inputPin3) ==low) {
for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(100);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);
} 
    for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(100);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);

}

ha there's the img code :stuck_out_tongue:

I cant wait to get started on this when I get ms arduino!

Thanks,
TBM :slight_smile:

Hmm.. Why not tie into flasher and brake light switch? Or is this what you're eventually going to do?

I'll probably do something like that, but fritzing doesn't have a switch like that.

btw I cant upload or put in a avatar all the links in the "Help" section are broken or just not there.