int Led = 5 ;// define LED Interface int buttonpin = 8; // define the mercury tilt switch sensor int val ;// define numeric variables val void setup() { pinMode(Led, OUTPUT) ;// define LED as output pinMode(buttonpin, INPUT) ;// define the mercury tilt switch sensor as input } void loop() { val = digitalRead(buttonpin) ;// read the values assigned to the digital 3 val if (val == HIGH) { // When the mercury tilt switch sensor detects a signal, LED flashes digitalWrite(Led, HIGH); } else { digitalWrite(Led, LOW); } }