Police Lights and Siren

i am making some police lights, and need two things;

sound players
"horn"

lets start with the "horn"
i need to use a pushbutton as a "horn" to change the void loop that runs... basically i want have 2 void loops, one for normal police lights, and one for when the "horn" is on. how do i write two void loops, and make them play by the pushbutton?

ex:
void loop 1
hsadf ajsdv das
dsvasvdsa

void loop 2
fvadsvasdvaASv
dsvasdddvd

if the pishbutton is off, void loop one plays, and if it is on, void loop two plays

Try out Tone library for the arduino
http://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation
I have not tested it yet, but there is a tutorial there.

David

anybody there?

in the siren loop, put in a "if btn == HIGH, then..." and pop the second loop there.

Does that help?

i want have 2 void loops

Sorry, no can do.

Could you maybe rewrite the question?

if btn == HIGH, then...

so, i use a pushbutton, and hook it to an analog pin... then i define it as "btn", and put "if btn == LOW, (code1) and then "if btn == HIGH, (code2)"

an i correct? also, how do i connect the pishbutton?

If you want to use HIGH and LOW, don't connect it to an analogue pin.

so how do i connect it?

Between GND and a digital pin, with the pin configured as INPUT, and with the internal pull-up enabled.
It will read HIGH when the switch is open.

any schematics / code? im confused

hello? i need help... im at the point of the switch...

Read reply #9

// connect switch between digital pin 2 and GND
const int BUTTON_PIN = 2;

void setup ()
{
  Serial.begin (9600);
  pinMode(BUTTON_PIN, INPUT);
  digitalWrite (BUTTON_PIN, HIGH); // apply pull-up
}

void loop ()
{
  if (digitalRead (BUTTON_PIN)  == LOW)) {
    Serial.println ("Switch closed");
  } else {
    Serial.println ("Switch open");
  }
}