Accelerometer & push button

Your code layout isn't brilliant - you'll find the control structures much easier to see and understand if you put each { and } on separate lines with matching pairs indented by the same amount and the bits between them indented one extra level.

The button processing logic looks OK (although you seem to be confused about the difference between speakers and LEDs assuming you have a momentary button connected and want to toggle the output state each time you press the button. However, the accelerometer processing seems to simply turn the outputs on and off according to the amount of acceleration - it doesn't seem to be toggling them on and off as the switch code does. Hence, whatever your switch logic might do will immediately be overwritten by the outputs set from the accelerometer code. I think you need to decide how these two sets of inputs will be combined to control the LEDs. In the short term you could test whether the button logic actually does what you expect by disabling the code handling acceleration.