In this setup we ended up using an NPN transistor. This is a helpful site to learn about the differences in transistors and how they work: Click
int led=3;//base
int button=4;
int vcc=5;
int ground=13;
void onoff(void);
void setup(){
pinMode(led, OUTPUT);
pinMode(button, INPUT);
pinMode(vcc, OUTPUT);
pinMode(ground, OUTPUT);
digitalWrite(led, LOW);
digitalWrite(ground, LOW);
digitalWrite(vcc, HIGH);
Serial.begin(9600);
}
void loop(){
if(digitalRead(button)==1){
onoff();
Serial.println("I am shooting--PEW");
}
}
void onoff(void){
for(int i=0; i<3; i++){
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
delay(100);
}
delay(500);//delay between shots
}
Here is the promised circuits diagram: