Howdy,
I should preface that I have little to no coding experience, that being said, I'm currently trying to make a gun prop. Pretty much all I need is for a to have an LED blink and a "firing" sound loop as long as a button is held. I've been following a similar build guide on Adafruit and I have all the parts just instead of the NeoPixel Ring and its associated code I have a single LED that needs to blink. I knows its probably a simpler code than whats shown in that build, Im just not sure what to take out/put in.
Look at the Learning tab at the top of the page and learn how to read a switch. It involves connecting a switch from an input to ground and using a pull-up R. Also look at while loops.
It is all basic programming and you need to know the basics to allow further programming.
Weedpharma
Trying to modify that program would be the hard way to do what you want to do.
There are lots of Arduino tutorials out there and the first thing most show you is how to blink an LED.
Not long after they will show you how to use a button and your half way there.
That is a excellent first project and after you've gone through a good tutorial series you should be able to do it easily. A few hrs effort you could have it done in a day.
Like Weedpharma said it's just the basics and once you get them down you can do lots of cool shtuff.
I don't think the sound module is controlled with code.
I copied the code into the Arduino IDE and started removing the Neopixel code and this is what I was left with.
//Written by Tony DiCola for Adafruit Industries.
//Adafruit invests time and resources providing this open source code,
//please support Adafruit and open-source hardware by purchasing products
//from Adafruit!
//BSD license, all text above must be included in any redistribution.
#define FIREPIN 2 // Fire button
int buttonState = 0;
void setup() {
pinMode(FIREPIN, INPUT_PULLUP);
}
void loop() {
uint8_t i;
//Button switch
buttonState = digitalRead(FIREPIN);
// check if the pushbutton is pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
// Run It:
}
else {
}
}
In case it's not clear, the code pulls the fire pin high and checks to see if the pin has been pulled low. Without the NeoPixel code, there's nothing for the program to do.
The sound module must work independently. It looks like you don't need to Arduino to control it.
It's possible to purchase LEDs which blink on their own. You could have the trigger of the gun connect power to one of these blinking LEDs and not even use a microcontroller.
Of course everything is more fun with a microcontroller involved so you'll want to use one anyway.
I agree with the suggestions to work through the tutorials.
Make sure and check back if you get stuck.