Computer makes USB connection sound when I press my push button

When ever I go to my first push button that is hooked up in active-low, it makes the sound from my computer speakers as if I were connecting or disconnecting a USB into my computer. It's supposed to make my greenLED come on lol. Why is it making the USB sound from my computer speakers instead? (Windows XP OS btw)

int buttonPin1 = 4;               // pushbutton 1 switch is connected to pin 4
int buttonPin2 = 2;               // pushbutton 2 switch is connected to pin 2
int greenLED = 6;                 // the green LED is connected to pin 6 
int yellowLED = 7;                // the yellow LED is conncted to pin 7
int redLED = 8;                   // the red LED is conncted to pin 8


int pushbutton1;                  // pushbutton 1 pin
int pushbutton2;                  // pushbutton 2 pin
int doublecheck;                  // variable for reading the delayed status
int buttonState1;                 // variable to hold the button state; initial
int buttonState2;                 // initial state for button 2

int lightMode = 0;                // What mode is the light in?
int lightMode2 = 0;                // What mode is the light in?
int lightMode3 = 0;                // What mode is the light in?

void setup() {
  pinMode(buttonPin1, INPUT);     // Declare pushbutton as input
  pinMode(buttonPin2, INPUT);     // Declare pushbutton as input
  pinMode(greenLED, OUTPUT);      // Declare LED as output
  pinMode(yellowLED, OUTPUT);     // Declare LED as output
  pinMode(redLED, OUTPUT);        // Declare LED as output

  
  Serial.begin(9600);           
  buttonState1 = digitalRead(buttonPin1);   // read the initial state @ pin 1
  buttonState2 = digitalRead(buttonPin2);   // read the initial state @ pin 2
}

void loop(){
  
  pushbutton1 = digitalRead(buttonPin1);      // read input value and store it in val
  delay(10);                         
  
    if (pushbutton1 != buttonState1) {          // the button state has changed!
      if (pushbutton1 == HIGH)               // check if the button is pressed
        if (lightMode == 0) {                   // if its off
          lightMode = 1;                        // First time push
        }  
          else {
			  if (lightMode == 1) { //  if its pushed again, 
                lightMode = 0;                  // turn LED off
              }
			
          }
        }
      }
    
    buttonState1 = pushbutton1;                 // save the new state into variable
    
    
    
    
 
  if (lightMode == 0) { // LED is off
 
    digitalWrite(greenLED, LOW);
    
    
   
  }


  if (lightMode == 1) { // green LED flashes at 2Hz
    digitalWrite(greenLED, HIGH);
    delay(500);
    digitalWrite(greenLED, LOW);
    delay(500);
 
  }

What kind of arduino?
It is powered via USB?
I don't see you sending out via Serial, like a bell character.
By active low, you mean the pin has a pull down resistor on the input pin, and the button connects it to +5V?
If so, I would guess something is not wired right, causing the arduino to reset and you are shorting the +5 to Gnd.

Much better way is to use internal pullup resistor:
pinMode(buttonPin1, INPUT); // Declare pushbutton as input
digitalWrite (buttonPin1, HIGH); // enable internal pullup

then look for a low on the pin to indicate the button is pushed. Then the 5V can't be hosed if something is miswired, and you cut out some external components.

You didn't post enough code to be sure, but you have both buttonPin1 and pushbutton1 declared. If you use the declared, uninitialized variables as pins, you're likely to pull pin 0. That is connected to the serial converter. My guess is that the long signal will reset the USB part of that converter, which will make it act as if you plugged it out and then in again.

If you use one of the first two pins (0 and 1) as I/O pins, it may interfere with the serial communication.

How is your pushbutton wired?

CrossRoads:
What kind of arduino?
It is powered via USB?
I don't see you sending out via Serial, like a bell character.
By active low, you mean the pin has a pull down resistor on the input pin, and the button connects it to +5V?
If so, I would guess something is not wired right, causing the arduino to reset and you are shorting the +5 to Gnd.

Much better way is to use internal pullup resistor:
pinMode(buttonPin1, INPUT); // Declare pushbutton as input
digitalWrite (buttonPin1, HIGH); // enable internal pullup

then look for a low on the pin to indicate the button is pushed. Then the 5V can't be hosed if something is miswired, and you cut out some external components.

Arduino Uno

Powered via USB.

I hooked up the active low as pictured

There isn't a pinMode for 0 tho, I don't think that's it. I don't think messing with the serial lines would do that.
Interfere with Comm's yes, but there isn't any going on.

So you have a 10K pullup, and the junction of the resistor and switch goes to the input pin?

Check the resistor, see that it's really 10K (stripes are brown-black-orange), or measure with a multimeter.
Better yet, ditch the resistor and just use the internal pullup.

I'm off to bed ...

CrossRoads:
There isn't a pinMode for 0 tho, I don't think that's it. I don't think messing with the serial lines would do that.
Interfere with Comm's yes, but there isn't any going on.

So you have a 10K pullup, and the junction of the resistor and switch goes to the input pin?

Yes. I've tried hooking up my input in between the resistor and switch, and in between the pin and ground. Neither worked.

I did try hooking it up into an active high setup and changing the code to accommodate the active high setup and my LEDs were working fine. It just keeps making the USB connection sound if I put it into active low setup.

Ok, try just the internal pullup resistor and switch to ground.

if (pushbutton1 == LOW) // check if the button is pressed

Try rotating the swith 90 degrees also - typically pins 1/3 and 2/4 are connected internally, or 1/2 and 3/4. So could just be missing the connection.

The issue is that, according to your picture, your push button is wired to complete a circuit between arduino 5v and arduino GND, which will make the arduino stop functioning, and the computer will see it as disconnected.

bilbo:
The issue is that, according to your picture, your push button is wired to complete a circuit between arduino 5v and arduino GND, which will make the arduino stop functioning, and the computer will see it as disconnected.

Actually the PC is disconnecting because a button wired to 5vdc and ground and then pressed creates a short circuit (over current) situation and then it's a race between the on-board 500ma thermofuse opening up or the PC protecting itself by removing power from the USB connector. Some PCs have internal USB power fuses that blow open and then have to be replaced.

Lefty