RGB led and button question. It's not working.

Hi. I'm wondering why my led's arn't working again. I have a button hooked up to pin 3, and pins on the leds to 4, 5, and 6. What I want to do is when the button is pushed, it will flash pin 6 2 times. Pins 4 and 5 switch between each other. Here's my code:

//int hit = 3;     // the number of the pushbutton pin
int buttonState = 0;         // variable for reading the pushbutton status
int delay1 = 200;

void setup() {
  pinMode(4, OUTPUT);      
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(3, INPUT);  
  digitalWrite(4, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(6, HIGH);
  //digitalWrite(4, HIGH);  
 //digitalWrite(buttonState, LOW);  //enable internal pullup resister 
}

void loop(){
  buttonState = digitalRead(3);
  if (buttonState == HIGH) {     
    digitalWrite(6, LOW);  
  } 
  else {
    digitalWrite(6, HIGH);
    b();
    g(); 
  }
}

void b(){
  digitalWrite(5, HIGH);
  digitalWrite(4, LOW);
  delay(delay1);
}

void g(){
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(delay1);
}

Thanks.

post your schematic, lets see what you have wired up.

You have nothing debouncing your button push, I would start with that.
Then add a "for x = 1 to 6" loop to write that pin hi/low 6 times with some delay after the change so you can see it.

There the same ones as before, but I'll try to draw one up quick.

Same ones as before what? I haven't seen anything.
Need to treat each post as a standalone item, or put some links in or something.

Ok. Here's just a basic layout I made: https://sites.google.com/site/arduinosoapy29/rgb-led-and-button It is really bad cause I'm using Windows 7...

Oh and this post. Took me a little while to find on the new layout. (I don't like the new forums at all!) http://arduino.cc/forum/index.php/topic,28527.0/topicseen.html

So something like this?
(go to expresspcb & download their schematic tool, very easy to use)

No. There's 3 RGB led's, and there each hooked to each other. The + pin on each led has a 330ohm resister tied to 5V. The other ends go into pins 4 5 and 6. The button hasone side on ground, and the other with a 330ohm resister to pin 3. I downloaded the program you said, and I don't get it. Not that easy for me. There's no RGB led in the components manager.

So this then:

Exacaly. I tried transisters, but they act funny when anyone is around them. If you get to close, the trigger... Stuipd transister. Now I'm trying a laser and it turned out to be a variable laser... XD whoops

Okay the resistor on the switch is doing nothing for you.
Remove, and add this this to void setup()
digitalWrite (3, HIGH);
that will turn on your internal pullup resistor and give you a High reading when the button is not pushed.
Right now , your input is floating.

It works, but just not how I want it to. What it does, is when the button is pressed, depending which color is on depends on how long it will take before red goes on. What I'd like it todo is when the button is pressed, it will add one to a variable and automatically switch it to red.

Well, now that your hardware is working, you can go back to fixing the code.
Until you get the button debounced, its kind of random what will happen in the loop when it is pressed. Start with that.
If you define the pins 4,5,6, as red-blue-green or whatever, it would probably make writing a color choice possilble.

Ok? Well can you help me with the transister problem?

what's the transistor to do? more current draw than arduino can provide?

We'll I don't know how much current my laser is that I'm using. My friend hacked it and gave it to me. It's 3V though, and to be safe, I run it with the transister. Problem is with the transister (any kind), when I get to close, it acts like the Arduino triggered it.

Describe how it is hooked up and what it is controlling - the 3v supply? the ground? some on/off signal?

Sphere side forward, left pin is ground to the laser, middle pin is to a resister (330ohm to Arduino pin), and the right pin is Arduino ground and the other battery ground.

So where does the laser get power from? All you describe is grounds an arduino digital pin which won't do it.

Top image: https://sites.google.com/site/arduinosoapy29/rgb-led-and-button