Add tilt switch to light sensing LED

Hi,

my first project is a light sensor running an LED.

I want to add a tilt switch to allow the light to be turned off when its dark my turning the board upsidedown.

my sketch is:

#define LED 13 // the pin for the LED
int val = 0;      

                        // variable used to store the value
                        // coming from the sensor
void setup() { 
  pinMode(LED, OUTPUT); 

                      // LED is as an OUTPUT

                  // Note: Analogue pins are automatically set as inputs
} 
                   // a threshold to decide when the LED turns on
int threshold = 200;
void loop() {

val = analogRead(0); // read the value from the sensor
if (val < threshold) digitalWrite(LED, HIGH); 
else digitalWrite(LED, LOW);

/
}

I tried to add a photo but having trouble finding the browse button to add it

Can you point me in the right direction?

Thanks

Dave

EDIT: Added photo

Point you in the right direction for adding a tilt switch, or posting a photo?

What sort of tilt switch?

(Make sure the URL of the photo is not on a local drive)

Thanks Groove,

I added the photo per your instructions.....

The tilt switch is a rolling ball type.

see link to store I bought it from

http://www.dse.com.au/cgi-bin/dse.storefront/4b86459b02a23d6c273fc0a87e0106b3/Product/View/P7863

Thanks Dave

drive one pin as an output, run it throuhg the tilt switch to another pin as an input and use a while or if statement in your code looking for the switch to be on or off.

Also put a resistor in series with that LED, you are damaging your arduino by not doing so.

http://www.thebox.myzen.co.uk/Tutorial/LEDs.html