If that is what you are using for your LED code, then why did you attach different code in your original post?
You should start with that code [and include it properly, not a link] and then begin adding your switches
The original code
byte led = 9; // which pin LED is connected to MUST USE PWM PIN
byte intensity = 0; // value for PWM setting on led pin, LED brightness
byte rampUp = 1; // amount the brightness steps for each iteration of the loop
byte stepTimer = 40; // duration between steps of the loop
float flareTimer; // duration the flare effect stays bright
byte flares = 1; // number of "strobe" effects to perform
void setup() {
pinMode(led, OUTPUT);
analogWrite(led, 0);
flareTimer = (stepTimer * 0.9);
}
void loop () {
intensity = intensity + rampUp;
analogWrite(led, intensity);
if (intensity >= 30) {
flareEffect(flares, flareTimer, led);
}
if (intensity <= 0) {
delay(350);
rampUp = -rampUp;
} if (intensity >= 30) {
rampUp = -rampUp;
}
delay(stepTimer);
}
void flareEffect (byte flares, float flareTimer, byte led) {
for (int flareCount = 0; flareCount < flares; flareCount++) {
analogWrite(led, 30);
delay(40);
analogWrite(led, 255);
delay(flareTimer);
}
}
Start there. Rename your loop() function to be beacon(). Add a new loop() function that checks your switches and if they are HIGH/LOW [depending on your wiring...] then call the beacon() function.
byte led = 9; // which pin LED is connected to MUST USE PWM PIN
byte intensity = 0; // value for PWM setting on led pin, LED brightness
byte rampUp = 1; // amount the brightness steps for each iteration of the loop
byte stepTimer = 40; // duration between steps of the loop
float flareTimer; // duration the flare effect stays bright
byte flares = 1; // number of "strobe" effects to perform
void setup() {
pinMode(led, OUTPUT);
analogWrite(led, 0);
flareTimer = (stepTimer * 0.9);
pinMode(A5, INPUT);// Arm 1
pinMode(A4, INPUT);// Arm 2
pinMode(A3, INPUT);// Arm 3
pinMode(A2, INPUT);// Arm 4
}
void loop() {
// put your code here to check the state of the switches
}
void beacon() {
intensity = intensity + rampUp;
analogWrite(led, intensity);
if (intensity >= 30) {
flareEffect(flares, flareTimer, led);
}
if (intensity <= 0) {
delay(350);
rampUp = -rampUp;
} if (intensity >= 30) {
rampUp = -rampUp;
}
delay(stepTimer);
}
void flareEffect(byte flares, float flareTimer, byte led) {
for (int flareCount = 0; flareCount < flares; flareCount++) {
analogWrite(led, 30);
delay(40);
analogWrite(led, 255);
delay(flareTimer);
}
}
The actual code is left as an exercise.
FYI... the "beacon" code is not very robust. If your ramp variable every changes it may break since the intensity variable is of type byte (0-255) and the code checks to see if it is less than 0 (which is never will be) and if your ramp is such that it doesn't actually reach 0, it will never change ramp direction.